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

stockInDetail.vue 26KB

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