cancelStockDetail.vue 26KB

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