stockInDetail.vue 31KB

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