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

stockInDetail.vue 25KB

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