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

stockInDetail.vue 26KB

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