stockInDetail.vue 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. <template>
  2. <div>
  3. <el-button
  4. style="float: right"
  5. size="small"
  6. icon="el-icon-printer"
  7. @click="PrintAction"
  8. type="primary"
  9. >打印
  10. </el-button>
  11. <el-button
  12. style="float: right;margin-right:10px"
  13. size="small"
  14. @click="exportListDetal"
  15. type="primary"
  16. >明细导出
  17. </el-button>
  18. <el-button
  19. style="float: right;margin-right:10px"
  20. size="small"
  21. @click="exportList"
  22. type="primary"
  23. >汇总导出
  24. </el-button>
  25. <div class="cell clearfix">
  26. <el-input
  27. size="small"
  28. style="width: 400px;"
  29. class="filter-item"
  30. v-model.trim="searchKey"
  31. placeholder="单据编码/制单人/规格名称/耗材名称"
  32. />
  33. <el-button
  34. size="small"
  35. class="filter-item"
  36. type="primary"
  37. icon="el-icon-search"
  38. @click="search"
  39. >搜索</el-button
  40. >
  41. <div style="margin-left:10px;">
  42. <label class="title"><span class="name">日期查询</span> : </label>
  43. <el-date-picker
  44. size="small"
  45. v-model="start_time"
  46. prefix-icon="el-icon-date"
  47. :editable="false"
  48. style="width: 150px;"
  49. type="date"
  50. placeholder="选择日期时间"
  51. align="right"
  52. format="yyyy-MM-dd"
  53. value-format="yyyy-MM-dd"
  54. @change="startTimeChange"
  55. ></el-date-picker>
  56. <span class="cellLine"> - </span>
  57. <el-date-picker
  58. size="small"
  59. v-model="end_time"
  60. prefix-icon="el-icon-date"
  61. :editable="false"
  62. style="width: 150px;"
  63. type="date"
  64. placeholder="选择日期时间"
  65. align="right"
  66. format="yyyy-MM-dd"
  67. value-format="yyyy-MM-dd"
  68. @change="endTimeChange"
  69. ></el-date-picker>
  70. </div>
  71. </div>
  72. <el-row :gutter="12" style="margin-top: 10px">
  73. <el-table
  74. :data="cancelStockDate"
  75. :class="signAndWeighBoxPatients"
  76. border
  77. highlight-current-row
  78. ref="multipleTable"
  79. @selection-change="select"
  80. :row-style="{ color: '#303133' }"
  81. :header-cell-style="{
  82. backgroundColor: 'rgb(245, 247, 250)',
  83. color: '#606266'
  84. }"
  85. >
  86. <el-table-column label="单据编号" align="center" width="200">
  87. <template slot-scope="scope">
  88. {{ scope.row.warehousing_order }}
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="耗材类型" align="center">
  92. <template slot-scope="scope">
  93. {{ typeName(scope.row.good_type_id) }}
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="耗材名称" align="center">
  97. <template slot-scope="scope">
  98. {{ typeNameOne(scope.row.good_id) }}
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="规格型号" align="center">
  102. <template slot-scope="scope">
  103. {{ specificationName(scope.row.good_id) }}
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="操作时间" align="center">
  107. <template slot-scope="scope">
  108. {{ getTime(scope.row.Warehousing.warehousing_time) }}
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="制单人" align="center">
  112. <template slot-scope="scope">
  113. {{ getXuserName(scope.row.Warehousing.creater) }}
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="进货价" align="center">
  117. <template slot-scope="scope">
  118. {{ scope.row.price }}
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="数量" align="center">
  122. <template slot-scope="scope">
  123. {{ scope.row.warehousing_count }}
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="总价" align="center">
  127. <template slot-scope="scope">
  128. <span v-if="scope.row.is_total == 0">{{
  129. getTotal(scope.row.price, scope.row.warehousing_count)
  130. }}</span>
  131. <span v-else>{{ scope.row.total }}</span>
  132. </template>
  133. </el-table-column>
  134. </el-table>
  135. <el-pagination
  136. @size-change="handleSizeChange"
  137. @current-change="handleCurrentChange"
  138. :page-sizes="[10, 50, 100]"
  139. :page-size="10"
  140. background
  141. style="margin-top:20px;float: right"
  142. layout="total, sizes, prev, pager, next, jumper"
  143. :total="total"
  144. >
  145. </el-pagination>
  146. </el-row>
  147. </div>
  148. </template>
  149. <script>
  150. import { uParseTime } from "@/utils/tools";
  151. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  152. import {
  153. deleteCancelStock,
  154. GetAllConfig,
  155. getStockDetail,
  156. getPrintStockGood,
  157. getGoodDetailPrintList
  158. } from "@/api/stock";
  159. export default {
  160. name: "stockInDetail",
  161. created() {
  162. var nowDate = new Date();
  163. var nowYear = nowDate.getFullYear();
  164. var nowMonth = nowDate.getMonth() + 1;
  165. var nowDay = nowDate.getDate();
  166. this.end_time =
  167. nowYear +
  168. "-" +
  169. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  170. "-" +
  171. (nowDay < 10 ? "0" + nowDay : nowDay);
  172. nowDate.setMonth(nowDate.getMonth() - 1);
  173. nowYear = nowDate.getFullYear();
  174. nowMonth = nowDate.getMonth() + 1;
  175. nowDay = nowDate.getDate();
  176. this.start_time =
  177. nowYear +
  178. "-" +
  179. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  180. "-" +
  181. (nowDay < 10 ? "0" + nowDay : nowDay);
  182. var start_time = window.sessionStorage.getItem('start_time')
  183. var end_time = window.sessionStorage.getItem('end_time')
  184. if(start_time !=null){
  185. this.start_time = start_time
  186. }
  187. if(end_time!=null){
  188. this.end_time = end_time
  189. }
  190. window.sessionStorage.removeItem('start_time')
  191. window.sessionStorage.removeItem('end_time')
  192. this.GetCancelStock();
  193. this.GetConfigInfo();
  194. this.fetchAllAdminUsers();
  195. this.goodUnit = this.$store.getters.good_unit
  196. this.org_id = this.$store.getters.xt_user.template_info.org_id
  197. this.getGoodDetailPrintList()
  198. },
  199. data() {
  200. return {
  201. orderTypeArr: [
  202. { value: 1, label: "耗材入库单" },
  203. { value: 2, label: "其他入库单" }
  204. ],
  205. newDate: [{ name: "合计", num: "111111" }],
  206. searchKey: "",
  207. type: 1,
  208. page: 1,
  209. limit: 10,
  210. manufacturer_id: "",
  211. dealer_id: "",
  212. order_type: "",
  213. checked: false,
  214. total: 0,
  215. pageTotal: 0,
  216. pageSelect: 0,
  217. adminUserOptions: [],
  218. multipleSelection: [],
  219. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  220. start_time: "",
  221. cancelStockDate: [],
  222. end_time: "",
  223. goodType: [],
  224. goodInfo: [],
  225. manufacturer: [],
  226. selectedTableData: [],
  227. dealer: [],
  228. tableList:[],
  229. goodUnit:[],
  230. stockTotal:[],
  231. org_id:0,
  232. tableInfo:[],
  233. tableDataList:[],
  234. };
  235. },
  236. methods: {
  237. changeType: function(val) {
  238. this.order_type = val;
  239. this.GetCancelStock();
  240. // this.getPrintStockGood()
  241. },
  242. changeManufacturer: function(val) {
  243. this.manufacturer_id = val;
  244. this.GetCancelStock();
  245. // this.getPrintStockGood()
  246. },
  247. changeDealer: function(val) {
  248. this.dealer_id = val;
  249. this.GetCancelStock();
  250. // this.getPrintStockGood()
  251. },
  252. getTypeName: function(row) {
  253. let name = "";
  254. if (row.type == 1) {
  255. name = "耗材入库单";
  256. } else if (row.type == 2) {
  257. name = "其他入库单";
  258. }
  259. return name;
  260. },
  261. typeName: function(good_type_id) {
  262. let name = "";
  263. for (let i = 0; i < this.goodType.length; i++) {
  264. if (this.goodType[i].id == good_type_id) {
  265. name = this.goodType[i].type_name;
  266. }
  267. }
  268. return name;
  269. },
  270. typeNameOne:function(good_id){
  271. let name = "";
  272. for (let i = 0; i < this.goodInfo.length; i++) {
  273. if (this.goodInfo[i].id == good_id) {
  274. name = this.goodInfo[i].good_name;
  275. }
  276. }
  277. return name;
  278. },
  279. specificationName: function(good_info_id) {
  280. let name = "";
  281. for (let i = 0; i < this.goodInfo.length; i++) {
  282. if (this.goodInfo[i].id == good_info_id) {
  283. name = this.goodInfo[i].specification_name;
  284. }
  285. }
  286. return name;
  287. },
  288. search: function() {
  289. const Params = {
  290. page: this.page,
  291. limit: this.limit,
  292. start_time: this.start_time,
  293. end_time: this.end_time,
  294. type: this.type,
  295. keywords: this.searchKey
  296. };
  297. this.cancelStockDate = [];
  298. this.tableList = []
  299. getStockDetail(Params).then(response => {
  300. if (response.data.state == 0) {
  301. this.$message.error(response.data.msg);
  302. return false;
  303. } else {
  304. this.total = response.data.data.total;
  305. var total_price = 0
  306. for (let i = 0; i < response.data.data.list.length; i++) {
  307. this.tableList.push(response.data.data.list[i])
  308. var obj = response.data.data.list[i];
  309. total_price += response.data.data.list[i].price * response.data.data.list[i].warehousing_count
  310. obj["is_total"] = 0;
  311. this.cancelStockDate.push(obj);
  312. }
  313. this.cancelStockDate.push({
  314. warehousing_order: "合计",
  315. is_total: 1,
  316. total: total_price,
  317. Warehousing: {
  318. warehousing_time: 0
  319. }
  320. });
  321. }
  322. });
  323. },
  324. getTime: function(val) {
  325. if (val == 0) {
  326. return "";
  327. } else {
  328. return uParseTime(val, "{y}-{m}-{d}");
  329. }
  330. },
  331. AddNewOrder: function() {
  332. this.$router.push({
  333. name: "cancelStockOrderAdd",
  334. query: { type: this.type }
  335. });
  336. },
  337. GetCancelStock: function() {
  338. const Params = {
  339. page: this.page,
  340. limit: this.limit,
  341. start_time: this.start_time,
  342. end_time: this.end_time,
  343. type: this.type,
  344. manufacturer: this.manufacturer_id,
  345. order_type: this.order_type,
  346. dealer: this.dealer_id
  347. };
  348. this.cancelStockDate = [];
  349. getStockDetail(Params).then(response => {
  350. if (response.data.state == 0) {
  351. this.$message.error(response.data.msg);
  352. return false;
  353. } else {
  354. this.total = response.data.data.total;
  355. var total_price = 0
  356. for (let i = 0; i < response.data.data.list.length; i++) {
  357. total_price += parseInt(response.data.data.list[i].warehousing_count) * response.data.data.list[i].price
  358. this.tableList.push(response.data.data.list[i])
  359. var obj = response.data.data.list[i];
  360. obj["is_total"] = 0;
  361. this.cancelStockDate.push(obj);
  362. }
  363. this.tableDataList = response.data.data.list
  364. this.cancelStockDate.push({
  365. warehousing_order: "合计",
  366. is_total: 1,
  367. total:total_price.toFixed(2),
  368. Warehousing: {
  369. warehousing_time: 0
  370. }
  371. });
  372. }
  373. });
  374. },
  375. getXuserName(id) {
  376. if (id <= 0) {
  377. return "";
  378. }
  379. var name = "";
  380. if (
  381. this.adminUserOptions == null ||
  382. typeof this.adminUserOptions.length === "undefined"
  383. ) {
  384. return name;
  385. }
  386. var leng = this.adminUserOptions.length;
  387. if (leng == 0) {
  388. return name;
  389. }
  390. for (let index = 0; index < leng; index++) {
  391. if (this.adminUserOptions[index].id == id) {
  392. name = this.adminUserOptions[index].name;
  393. break;
  394. }
  395. }
  396. return name;
  397. },
  398. fetchAllAdminUsers() {
  399. fetchAllAdminUsers().then(response => {
  400. if (response.data.state == 1) {
  401. this.adminUserOptions = response.data.data.users;
  402. var alen = this.adminUserOptions.length;
  403. for (let index = 0; index < alen; index++) {
  404. if (this.adminUserOptions[index].user_type == 2) {
  405. }
  406. }
  407. }
  408. });
  409. },
  410. handleSelectionChange: function(val) {
  411. this.multipleSelection = val;
  412. },
  413. handleSizeChange(val) {
  414. console.log("val2332323223",val)
  415. this.limit = val;
  416. this.GetCancelStock();
  417. },
  418. handleCurrentChange(val) {
  419. console.log("888888",val)
  420. this.page = val;
  421. this.GetCancelStock();
  422. },
  423. startTimeChange(val) {
  424. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  425. if (time > 0) {
  426. this.$message.error("结束时间不能小于开始时间");
  427. this.start_time = "";
  428. } else {
  429. this.GetCancelStock();
  430. }
  431. },
  432. endTimeChange(val) {
  433. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  434. if (time < 0) {
  435. this.$message.error("结束时间不能小于开始时间");
  436. this.end_time = "";
  437. } else {
  438. this.GetCancelStock();
  439. }
  440. },
  441. getTimestamp(time) {
  442. // 把时间日期转成时间戳
  443. return new Date(time).getTime() / 1000;
  444. },
  445. calculate: function(val) {
  446. return Math.round(parseFloat(val) * 100) / 100;
  447. },
  448. GetConfigInfo: function() {
  449. GetAllConfig().then(response => {
  450. if (response.data.state == 0) {
  451. this.$message.error(response.data.msg);
  452. return false;
  453. } else {
  454. this.manufacturer = response.data.data.manufacturer;
  455. this.dealer = response.data.data.dealer;
  456. this.goodInfo = response.data.data.goodInfo;
  457. this.goodType = response.data.data.goodType;
  458. }
  459. });
  460. },
  461. getManufactuerName: function(manufacturer_id) {
  462. for (let i = 0; i < this.manufacturer.length; i++) {
  463. if (this.manufacturer[i].id == manufacturer_id) {
  464. return this.manufacturer[i].manufacturer_name;
  465. }
  466. }
  467. },
  468. getDealerName: function(dealer_id) {
  469. for (let i = 0; i < this.dealer.length; i++) {
  470. if (this.dealer[i].id == dealer_id) {
  471. return this.dealer[i].dealer_name;
  472. }
  473. }
  474. },
  475. handleEdit: function(index, row) {
  476. this.$router.push({
  477. name: "cancelStockDetail",
  478. query: { id: row.id, type: this.type }
  479. });
  480. },
  481. handleDelete: function(index, row) {
  482. const ids = [];
  483. ids.push(row.id);
  484. const idStr = ids.join(",");
  485. const params = {
  486. ids: idStr
  487. };
  488. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  489. confirmButtonText: "确定",
  490. cancelButtonText: "取消",
  491. type: "warning"
  492. })
  493. .then(() => {
  494. deleteCancelStock(params).then(response => {
  495. if (response.data.state == 0) {
  496. this.$message.error(response.data.msg);
  497. return false;
  498. } else {
  499. this.$notify({
  500. title: "成功",
  501. message: "删除成功",
  502. type: "success",
  503. duration: 2000
  504. });
  505. for (let i = 0; i < ids.length; i++) {
  506. for (let y = 0; y < this.cancelStockDate.length; y++) {
  507. if (ids[i] == this.cancelStockDate[y].id) {
  508. this.cancelStockDate.splice(y, 1);
  509. }
  510. }
  511. }
  512. }
  513. });
  514. })
  515. .catch(() => {});
  516. },
  517. changeAllSelected: function(val) {
  518. if (val) {
  519. this.$refs.multipleTable.toggleAllSelection();
  520. } else {
  521. this.$refs.multipleTable.clearSelection();
  522. }
  523. },
  524. select(selection) {
  525. this.selectedTableData = selection;
  526. },
  527. batchDelete() {
  528. if (this.selectedTableData.length <= 0) {
  529. this.$message.error("请选择要删除的记录");
  530. return;
  531. }
  532. const ids = [];
  533. for (let i = 0; i < this.selectedTableData.length; i++) {
  534. ids.push(this.selectedTableData[i].id);
  535. }
  536. const idStr = ids.join(",");
  537. const params = {
  538. ids: idStr
  539. };
  540. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  541. confirmButtonText: "确定",
  542. cancelButtonText: "取消",
  543. type: "warning"
  544. })
  545. .then(() => {
  546. deleteCancelStock(params).then(response => {
  547. if (response.data.state == 0) {
  548. this.$message.error(response.data.msg);
  549. return false;
  550. } else {
  551. this.$notify({
  552. title: "成功",
  553. message: "删除成功",
  554. type: "success",
  555. duration: 2000
  556. });
  557. for (let i = 0; i < ids.length; i++) {
  558. for (let y = 0; y < this.cancelStockDate.length; y++) {
  559. if (ids[i] == this.cancelStockDate[y].id) {
  560. this.cancelStockDate.splice(y, 1);
  561. }
  562. }
  563. }
  564. }
  565. });
  566. })
  567. .catch(() => {});
  568. },
  569. getTotal: function(price, total) {
  570. var m = 0,
  571. r1,
  572. r2;
  573. var s1 = price.toString();
  574. var s2 = total.toString();
  575. try {
  576. m += s1.split(".")[1].length;
  577. } catch (e) {}
  578. try {
  579. } catch (e) {
  580. m += s2.split(".")[1].length;
  581. }
  582. r1 = Number(price.toString().replace(".", ""));
  583. r2 = Number(total.toString().replace(".", ""));
  584. return (r1 * r2) / Math.pow(10, m);
  585. },
  586. PrintAction: function() {
  587. window.sessionStorage.setItem('start_time',this.start_time)
  588. window.sessionStorage.setItem('end_time',this.end_time)
  589. this.$router.push({
  590. path: "/stock/print",
  591. query: {
  592. type: 1,
  593. start_time: this.start_time,
  594. end_time: this.end_time,
  595. limit:this.limit,
  596. page:this.page,
  597. keywords:this.$router.keywords,
  598. }
  599. });
  600. },
  601. getPrintStockGood(){
  602. const params = {
  603. start_time:this.start_time,
  604. end_time:this.end_time,
  605. type:1,
  606. }
  607. getPrintStockGood(params).then(response=>{
  608. if(response.data.state == 1){
  609. this.tableList = []
  610. var stockTotal = response.data.data.stockTotal
  611. this.stockTotal = stockTotal
  612. var list = response.data.data.list
  613. for(let i=0;i<list.length;i++){
  614. if (list[i].query_warehousing_info.length > 0) {
  615. this.tableList.push(list[i])
  616. }
  617. }
  618. }
  619. })
  620. },
  621. calCount(stock) {
  622. let total = 0
  623. var array = []
  624. array = stock.query_warehousing_info
  625. for (let i = 0; i < array.length; i++) {
  626. total = total + array[i].warehousing_count
  627. }
  628. return total
  629. },
  630. calTotal(stock) {
  631. var array = []
  632. array = stock.query_warehousing_info
  633. let total_price = 0.0
  634. for (let i = 0; i < array.length; i++) {
  635. total_price = total_price + array[i].warehousing_count * array[i].price
  636. }
  637. return Math.floor(total_price * 100) / 100
  638. },
  639. calTotalPrice() {
  640. var amountPrice = 0
  641. for (let i = 0; i < this.tableList.length; i++) {
  642. var obj = this.tableList[i]
  643. var len = 0
  644. len = obj.query_warehousing_info.length
  645. let total_price = 0.0
  646. for (let a = 0; a < len; a++) {
  647. total_price = total_price + obj.query_warehousing_info[a].total_price
  648. }
  649. amountPrice = amountPrice + Math.floor(total_price* 100) / 100
  650. }
  651. return Math.floor(amountPrice* 100) / 100
  652. },
  653. getStockCount(id){
  654. var count = ""
  655. for(let i=0;i<this.stockTotal.length;i++){
  656. if(id == this.stockTotal[i].good_id){
  657. count = this.stockTotal[i].count
  658. }
  659. }
  660. return count
  661. },
  662. getTotal: function(price, total) {
  663. var m = 0, r1, r2
  664. var s1 = price.toString()
  665. var s2 = total.toString()
  666. try {
  667. m += s1.split('.')[1].length
  668. } catch (e) {
  669. }
  670. try {
  671. } catch (e) {
  672. m += s2.split('.')[1].length
  673. }
  674. r1 = Number(price.toString().replace('.', ''))
  675. r2 = Number(total.toString().replace('.', ''))
  676. return r1 * r2 / Math.pow(10, m)
  677. },
  678. unique(arr) {
  679. const res = new Map();
  680. return arr.filter((arr) => !res.has(arr.specification_name) && res.set(arr.specification_name, 1));
  681. },
  682. uniqueOne(arr) {
  683. const res = new Map();
  684. return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1));
  685. },
  686. exportList(){
  687. for(let i=0;i<this.tableInfo.length;i++){
  688. this.tableInfo[i].index = i+1
  689. this.tableInfo[i].total_price = (this.tableInfo[i].warehousing_count * this.tableInfo[i].price).toFixed(2)
  690. }
  691. import('@/vendor/Export2Excel').then(excel => {
  692. const tHeader = ['序号','耗材名称', '规格型号', '单位','数量','进货价','总价','备注']
  693. const filterVal = ['index','good_name', 'specification_name', 'packing_unit','warehousing_count','price','total_price','remark']
  694. const data = this.formatJson(filterVal, this.tableInfo)
  695. excel.export_json_to_excel({
  696. header: tHeader,
  697. data,
  698. filename: '耗材入库明细'
  699. })
  700. this.downloadLoading = false
  701. })
  702. },
  703. exportListDetal(){
  704. var obj = {index:"合计",total_price:0}
  705. var total = 0
  706. for(let i=0;i<this.tableDataList.length;i++){
  707. this.tableDataList[i].index = i + 1
  708. this.tableDataList[i].good_type_name = this.typeName(this.tableDataList[i].good_type_id)
  709. this.tableDataList[i].good_name = this.typeNameOne(this.tableDataList[i].good_id)
  710. this.tableDataList[i].specification_name = this.specificationName(this.tableDataList[i].good_id)
  711. this.tableDataList[i].time = this.getTime(this.tableDataList[i].Warehousing.warehousing_time)
  712. this.tableDataList[i].user_name = this.getXuserName(this.tableDataList[i].Warehousing.creater)
  713. this.tableDataList[i].total_price = (this.tableDataList[i].warehousing_count * this.tableDataList[i].price).toFixed(2)
  714. total += this.tableDataList[i].warehousing_count * this.tableDataList[i].price
  715. }
  716. obj.total_price = total.toFixed(2)
  717. this.tableDataList.push(obj)
  718. import('@/vendor/Export2Excel').then(excel => {
  719. const tHeader = ['序号','单据编号', '耗材类型', '耗材名称','规格型号','操作时间','制单人','进货价','数量','总价']
  720. const filterVal = ['index','warehousing_order', 'good_type_name', 'good_name','specification_name','time','user_name','price','warehousing_count','total_price']
  721. const data = this.formatJson(filterVal, this.tableDataList)
  722. excel.export_json_to_excel({
  723. header: tHeader,
  724. data,
  725. filename: '耗材入库明细'
  726. })
  727. this.downloadLoading = false
  728. })
  729. },
  730. formatJson(filterVal, jsonData) {
  731. return jsonData.map(v => filterVal.map(j => v[j]));
  732. },
  733. getUnit(id){
  734. var name = ""
  735. for(let i=0;i<this.goodUnit.length;i++){
  736. if(this.goodUnit[i].id == id){
  737. name = this.goodUnit[i].name
  738. }
  739. }
  740. return name
  741. },
  742. getGoodDetailPrintList(){
  743. const params = {
  744. start_time:this.start_time,
  745. end_time:this.end_time,
  746. type:1,
  747. }
  748. getGoodDetailPrintList(params).then(response=>{
  749. if(response.data.state == 1){
  750. var list = response.data.data.list
  751. // console.log("入库详情单",list)
  752. this.tableInfo = list
  753. }
  754. })
  755. }
  756. }
  757. };
  758. </script>
  759. <style rel="stylesheet/css" lang="scss" scoped>
  760. .information {
  761. border: 1px #dcdfe6 solid;
  762. padding: 30px 20px 30px 20px;
  763. .border {
  764. border-bottom: 1px #dcdfe6 solid;
  765. margin: 0px 0 20px 0;
  766. }
  767. }
  768. .edit_separater {
  769. border-top: 1px solid rgb(233, 233, 233);
  770. margin-top: 15px;
  771. margin-bottom: 15px;
  772. }
  773. </style>
  774. <style>
  775. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  776. font-size: 12px;
  777. }
  778. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  779. background: #6fb5fa;
  780. }
  781. .count {
  782. color: #bd2c00;
  783. }
  784. .el-table td,
  785. .el-table th.is-leaf,
  786. .el-table--border,
  787. .el-table--group {
  788. border-color: #d0d3da;
  789. }
  790. .el-table--border::after,
  791. .el-table--group::after,
  792. .el-table::before {
  793. background-color: #d0d3da;
  794. }
  795. </style>