stockOutDetail.vue 24KB

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