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

print.vue 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. <el-button :loading="loading" size="small" icon="el-icon-printer" @click="printThisPage" type="primary">打印
  6. </el-button>
  7. </div>
  8. <div class="app-container ">
  9. <div id="dialysis-print-box">
  10. <div class="dialysis-print-order">
  11. <div class="order-yy-name">{{orgname}}</div>
  12. <div class="order-title" v-if="type == 1">入库单</div>
  13. <div class="order-title" v-if="type == 2">出库单</div>
  14. <div class="order-title" v-if="type == 4">退库单</div>
  15. <div style="float: left;margin-bottom: 10px;">{{getDateOne()}}</div>
  16. <div style="float: right;margin-bottom: 10px;">{{getDateTwo()}}</div>
  17. <table class="print-table" border="1">
  18. <tbody>
  19. <tr>
  20. <td style="line-height: 50px" width="50">序号</td>
  21. <td style="line-height: 50px" width="200">耗材名称</td>
  22. <td style="line-height: 50px" width="200">规格型号</td>
  23. <td style="line-height: 50px" width="80">数量</td>
  24. <td style="line-height: 50px" width="50">单位</td>
  25. <td style="line-height:50px" width="80">
  26. <span v-if="type == 1">进货价</span>
  27. <span v-if="type == 2">出货价</span>
  28. <span v-if="type == 4">退库价</span>
  29. </td>
  30. <td style="line-height: 50px" width="80">总价</td>
  31. <td style="line-height: 50px" width="80">备 注</td>
  32. </tr>
  33. <tr v-for="(item,index) in stockDatas" :key="item.id">
  34. <td style="line-height: 50px">&nbsp;
  35. {{index+1}}
  36. </td>
  37. <td style="line-height: 50px">
  38. <!-- <span>{{item.GoodInfo.good_name}}</span> -->
  39. {{item.good_name}}
  40. </td>
  41. <td style="line-height: 50px">
  42. <!-- <span>{{item.GoodInfo.specification_name}}</span> -->
  43. {{item.specification_name}}
  44. </td>
  45. <td style="line-height: 50px">
  46. <span v-if="type == 1"> {{ item.warehousing_count }}</span>
  47. <span v-if="type == 2"> {{getStockCount(item.good_id) }}</span>
  48. <span v-if="type == 4"> {{ item.count }}</span>
  49. </td>
  50. <td style="line-height: 50px">
  51. <!-- <span>{{item.GoodInfo.packing_unit}}</span> -->
  52. {{item.packing_unit}}
  53. </td>
  54. <td style="line-height:50px">
  55. <span v-if="type == 1"> {{ item.price }}</span>
  56. <span v-if="type == 2"> {{ item.packing_price }}</span>
  57. <span v-if="type == 4"> {{ item.price }}</span>
  58. </td>
  59. <td style="line-height:50px">
  60. <span v-if="type == 1">{{(item.warehousing_count * item.price).toFixed(2)}}</span>
  61. <span v-if="type == 2">{{(item.count * item.packing_price).toFixed(2)}}</span>
  62. <span v-if="type == 4">{{(item.count * item.price).toFixed(2)}}</span>
  63. </td>
  64. <td style="line-height: 50px">
  65. <span v-if="type == 1">{{item.remark}}</span>
  66. </td>
  67. </tr>
  68. </tbody>
  69. </table>
  70. <table class="print-table" border="1">
  71. <tr>
  72. <td style="line-height: 50px" colspan="6" width="550">合计</td>
  73. <td width="80" style="line-height: 50px" >
  74. <span v-if="type == 1">{{getWareInfoTotal().toFixed(2)}}</span>
  75. <span v-if="type == 2">{{getWareOutTotal().toFixed(2)}}</span>
  76. <span v-if="type == 4">{{getWareOutTotal().toFixed(2)}}</span>
  77. </td>
  78. <td width="80" style="line-height: 50px">
  79. </td>
  80. </tr>
  81. </table>
  82. <div style="display:flex;margin-top:20px;float:right;">
  83. <div style="width:50px;">审批:</div><div style="width:100px;"></div>
  84. <div style="width:80px;">药材主任:</div><div style="width:100px;"></div>
  85. <div style="width:50px;">会计:</div><div style="width:100px;"></div>
  86. <div style="width:50px;">审核:</div><div style="width:100px;"></div>
  87. <div style="width:70px;">制单人:</div><div style="width:100px;"></div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </template>
  94. <script>
  95. import { getPrintStockGood,getGoodDetailPrintList,getStockDetail } from '@/api/stock'
  96. import { getDataConfig } from '@/utils/data'
  97. import { jsGetAge, uParseTime } from '@/utils/tools'
  98. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  99. import print from 'print-js'
  100. export default {
  101. name: 'dialysisPrintOrder',
  102. components: {
  103. BreadCrumb
  104. },
  105. data() {
  106. return {
  107. crumbs: [
  108. { path: false, name: '出入库明细' },
  109. { path: false, name: '打印单' }
  110. ],
  111. loading: false,
  112. orgname: '',
  113. queryParams: {
  114. start_time: this.$route.query.start_time,
  115. end_time: this.$route.query.end_time,
  116. type: this.$route.query.type,
  117. limit:this.$route.query.limit,
  118. page:this.$route.query.page,
  119. },
  120. totalPrice: 0,
  121. stockDatas: [],
  122. goodUnit: [],
  123. type: this.$route.query.type,
  124. start_time: this.$route.query.start_time,
  125. end_time: this.$route.query.end_time,
  126. stockTotal:[],
  127. wareOutInfo:[],
  128. org_id:0,
  129. informationList:[]
  130. }
  131. },
  132. methods: {
  133. getDateOne(){
  134. if (this.type == 1){
  135. return "入库日期: "+this.start_time +"~"+this.end_time
  136. }else if(this.type == 2){
  137. return "退货日期: "+this.start_time +"~"+this.end_time
  138. }else if(this.type == 3){
  139. return "出库日期: "+this.start_time +"~"+this.end_time
  140. }else if(this.type == 4){
  141. return "退库日期: "+this.start_time +"~"+this.end_time
  142. }
  143. },
  144. getDateTwo(){
  145. var ptime = Math.round(new Date().getTime() / 1000)
  146. return "印单日期:"+uParseTime(ptime, '{y}-{m}-{d}')
  147. },
  148. getTime(value, temp) {
  149. if (value == 0) {
  150. return ''
  151. }
  152. if (value != undefined) {
  153. return uParseTime(value, temp)
  154. }
  155. return ''
  156. },
  157. printThisPage() {
  158. var ptime = Math.round(new Date().getTime() / 1000)
  159. this.print_time = uParseTime(ptime, '{y}-{m}-{d} {h}:{i}')
  160. const style = '@media print {.dialysis-print-order{width:960px;margin:0 auto}.dialysis-print-order .order-yy-name{margin:auto;text-align:center;font-size:20px;letter-spacing:5px}.dialysis-print-order .order-title{margin:auto;font-weight:600;text-align:center;font-size:22px;padding:10px 20px 20px 20px}.dialysis-print-order .table-box{width:100%;line-height:23px;font-size:14px}.dialysis-print-order .print-table{width:100%;text-align:center;border-collapse:collapse;line-height:25px;font-size:14px}.dialysis-print-order .print-table-no{width:100%;text-align:center;border-collapse:collapse;font-size:14px}.dialysis-print-order .under-line{border-bottom:1px solid #999;width:95%;text-align:center;margin-left:2px}.dialysis-print-order .title-box{text-align:center;font-size:16px;border:1px solid #666}.dialysis-print-order .radio-lebel-box{font-weight:400;cursor:pointer}.dialysis-print-order .radio-no{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;z-index:-1}.dialysis-print-order .radio-inner{white-space:nowrap;cursor:pointer;outline:0;display:inline-block;line-height:1;position:relative;vertical-align:middle}.dialysis-print-order .radio-fang{display:inline-block;position:relative;border:1px solid #000;box-sizing:border-box;width:14px;height:14px;background-color:#fff;z-index:1;transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46)}.dialysis-print-order .is-checked-radio::after{content:"√";font-size:15px}}.dialysis-print-order .print-table-no tr td { padding: 8px 5px; line-height: 25px; }.es-img{height: 20px; }.advice-name{text-align: left;}.advice-children{display:flex;} .dialysis-print-order .print-table tr td{padding: 0px 0px;} .print-template-two tr {line-height: 30px;} .title-box-pro{border: 0 #fff;line-height: 40px;height: 40px;text-align: left;padding-left: 10px !important;} .text-align-left{text-align: left !important;padding-left:10px !important;font-size: 14px !important;line-height: 25px;}'
  161. printJS({
  162. printable: 'dialysis-print-box',
  163. type: 'html',
  164. style: style,
  165. scanStyles: false
  166. })
  167. },
  168. getDialysisRecord() {
  169. this.loading = true
  170. getPrintStockGood(this.queryParams).then(response => {
  171. if (response.data.state == 1) {
  172. var stockTotal = response.data.data.stockTotal
  173. this.stockTotal = stockTotal
  174. var info = response.data.data.info
  175. this.wareOutInfo = info
  176. var org_id = response.data.data.orgid
  177. this.org_id = org_id
  178. var informationlist = response.data.data.infomationList
  179. this.informationList = informationlist
  180. this.stockDatas = []
  181. for (let i = 0; i < response.data.data.list.length; i++) {
  182. if (this.type == 1) {
  183. if (response.data.data.list[i].query_warehousing_info.length > 0) {
  184. this.stockDatas.push(response.data.data.list[i])
  185. }
  186. console.log("入库打印数据源",this.stockDatas)
  187. } else if (this.type == 2) {
  188. if (response.data.data.list[i].query_sales_return_info.length > 0) {
  189. this.stockDatas.push(response.data.data.list[i])
  190. }
  191. } else if (this.type == 3) {
  192. if (response.data.data.list[i].query_warehouseout_info.length > 0) {
  193. this.stockDatas.push(response.data.data.list[i])
  194. }
  195. console.log("出库打印数据源",this.stockDatas)
  196. } else if (this.type == 4) {
  197. if (response.data.data.list[i].query_cancel_stock_info.length > 0) {
  198. this.stockDatas.push(response.data.data.list[i])
  199. }
  200. }
  201. }
  202. var obj = null
  203. for(let i = 0; i <this.stockDatas.length;i++){
  204. obj = this.stockDatas[i]
  205. }
  206. console.log("9999999",this.stockDatas)
  207. var newArr = this.unique(this.stockDatas)
  208. console.log("耗材出库去重",newArr)
  209. this.stockDatas = newArr
  210. // if (this.stockDatas.length < 50) {
  211. // var nl = 50 - this.stockDatas.length
  212. // for (let index = 0; index < nl; index++) {
  213. // this.stockDatas.push([])
  214. // }
  215. // }
  216. this.loading = false
  217. } else {
  218. this.loading = false
  219. this.$message.error('请求数据失败')
  220. return false
  221. }
  222. })
  223. },
  224. calCount(stock) {
  225. let total = 0
  226. var array = []
  227. if (this.type == 1) {
  228. array = stock.query_warehousing_info
  229. } else if (this.type == 2) {
  230. array = stock.query_sales_return_info
  231. } else if (this.type == 3) {
  232. array = stock.query_warehouseout_info
  233. } else if (this.type == 4) {
  234. array = stock.query_cancel_stock_info
  235. }
  236. for (let i = 0; i < array.length; i++) {
  237. if (this.type == 1) {
  238. total = total + array[i].warehousing_count
  239. } else if (this.type == 2) {
  240. total = total + array[i].count
  241. } else if (this.type == 3) {
  242. total = total + array[i].count
  243. } else if (this.type == 4) {
  244. total = total + array[i].count
  245. }
  246. }
  247. return total
  248. }, calTotal(stock) {
  249. console.log(stock)
  250. var array = []
  251. if (this.type == 1) {
  252. array = stock.query_warehousing_info
  253. } else if (this.type == 3) {
  254. array = stock.query_warehouseout_info
  255. }
  256. let total_price = 0.0
  257. for (let i = 0; i < array.length; i++) {
  258. if(this.type == 1) {
  259. total_price = total_price + array[i].warehousing_count * array[i].price
  260. }else if(this.type == 3){
  261. total_price = total_price + array[i].count * array[i].price
  262. }
  263. }
  264. return Math.floor(total_price * 100) / 100
  265. },
  266. calTotalPrice() {
  267. var amountPrice = 0
  268. for (let i = 0; i < this.stockDatas.length; i++) {
  269. var obj = this.stockDatas[i]
  270. var len = 0
  271. if (this.type == 1) {
  272. len = obj.query_warehousing_info.length
  273. } else if (this.type == 3) {
  274. len = obj.query_warehouseout_info.length
  275. }
  276. let total_price = 0.0
  277. for (let a = 0; a < len; a++) {
  278. if (this.type == 1) {
  279. total_price = total_price + obj.query_warehousing_info[a].total_price
  280. } else if (this.type == 3) {
  281. total_price = total_price + obj.query_warehouseout_info[a].total_price
  282. }
  283. }
  284. amountPrice = amountPrice + Math.floor(total_price* 100) / 100
  285. }
  286. return Math.floor(amountPrice* 100) / 100
  287. }, getTotal: function(price, total) {
  288. var m = 0, r1, r2
  289. var s1 = price.toString()
  290. var s2 = total.toString()
  291. try {
  292. m += s1.split('.')[1].length
  293. } catch (e) {
  294. }
  295. try {
  296. } catch (e) {
  297. m += s2.split('.')[1].length
  298. }
  299. r1 = Number(price.toString().replace('.', ''))
  300. r2 = Number(total.toString().replace('.', ''))
  301. return r1 * r2 / Math.pow(10, m)
  302. },
  303. getUnit(id){
  304. var name = ""
  305. for(let i=0;i<this.goodUnit.length;i++){
  306. if(this.goodUnit[i].id == id){
  307. name = this.goodUnit[i].name
  308. }
  309. }
  310. return name
  311. },
  312. getStockCount(id){
  313. var count = ""
  314. for(let i=0;i<this.stockTotal.length;i++){
  315. if(id == this.stockTotal[i].good_id){
  316. count = this.stockTotal[i].count
  317. }
  318. }
  319. return count
  320. },
  321. getWareOut(id){
  322. var count = ""
  323. for(let i=0;i<this.wareOutInfo.length;i++){
  324. if(id == this.wareOutInfo[i].good_id){
  325. count = this.wareOutInfo[i].count
  326. }
  327. }
  328. return count
  329. },
  330. getPrice(id){
  331. var sum = ""
  332. for(let i=0;i<this.informationList.length;i++){
  333. for(let j=0;j<this.wareOutInfo.length;j++){
  334. if(this.informationList[i].id == this.wareOutInfo[j].good_id){
  335. this.wareOutInfo[j].buy_price = this.informationList[i].buy_price
  336. }
  337. }
  338. }
  339. for(let j=0;j<this.wareOutInfo.length;j++){
  340. if(id == this.wareOutInfo[j].good_id){
  341. sum += (this.wareOutInfo[j].buy_price * this.wareOutInfo[j].count).toFixed(2)
  342. }
  343. }
  344. return sum
  345. },
  346. getReailPrice(id){
  347. var price = 0
  348. for(let i=0;i<this.informationList.length;i++){
  349. if(id == this.informationList[i].id){
  350. price = this.informationList[i].buy_price
  351. }
  352. }
  353. return price
  354. },
  355. getTotalPrice(){
  356. var total_price = 0
  357. for(let i=0;i<this.stockDatas.length;i++){
  358. total_price += (this.getStockCount(this.stockDatas[i].id) * this.getReailPrice(this.stockDatas[i].id))
  359. }
  360. return total_price
  361. },
  362. getTotalPriceOne(){
  363. var total_price = 0
  364. for(let i=0;i<this.stockDatas.length;i++){
  365. total_price +=(this.getWareOut(this.stockDatas[i].id) * this.getReailPrice(this.stockDatas[i].id))
  366. }
  367. return total_price
  368. },
  369. unique(arr) {
  370. const res = new Map();
  371. return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1));
  372. },
  373. getGoodDetailPrintList(){
  374. getGoodDetailPrintList(this.queryParams).then(response=>{
  375. if(response.data.state == 1){
  376. var list = response.data.data.list
  377. console.log("新的",list)
  378. this.stockDatas = list
  379. var stockTotal = response.data.data.stockTotal
  380. this.stockTotal = stockTotal
  381. }
  382. })
  383. },
  384. getStockDetail(){
  385. getStockDetail(this.queryParams).then(response=>{
  386. if(response.data.state == 1){
  387. var total = response.data.data.total
  388. var list = response.data.data.list
  389. this.stockDatas = list
  390. }
  391. })
  392. },
  393. getWareInfoTotal(){
  394. var total = 0
  395. for(let i=0;i<this.stockDatas.length;i++){
  396. total+= this.stockDatas[i].warehousing_count * this.stockDatas[i].price
  397. }
  398. return total
  399. },
  400. getWareOutTotal(){
  401. var total = 0
  402. for(let i=0;i<this.stockDatas.length;i++){
  403. total+= this.stockDatas[i].count * this.stockDatas[i].packing_price
  404. }
  405. return total
  406. }
  407. },
  408. created() {
  409. var xtuser = this.$store.getters.xt_user
  410. this.orgname = xtuser.org.org_name
  411. this.goodUnit = this.$store.getters.good_unit
  412. // this.getDialysisRecord()
  413. this.getGoodDetailPrintList()
  414. // this.getStockDetail()
  415. }
  416. }
  417. </script>
  418. <style>
  419. .dialysis-print-order {
  420. width: 960px;
  421. margin: 0 auto
  422. }
  423. .dialysis-print-order .order-yy-name {
  424. margin: auto;
  425. text-align: center;
  426. font-size: 20px;
  427. letter-spacing: 5px;
  428. }
  429. .dialysis-print-order .order-title {
  430. margin: auto;
  431. font-weight: 600;
  432. text-align: center;
  433. font-size: 22px;
  434. padding: 10px 20px 20px 20px;
  435. }
  436. .dialysis-print-order .table-box {
  437. width: 100%;
  438. line-height: 23px;
  439. font-size: 14px;
  440. }
  441. .dialysis-print-order .print-table {
  442. width: 100%;
  443. text-align: center;
  444. border-collapse: collapse;
  445. line-height: 40px;
  446. font-size: 14px;
  447. }
  448. .dialysis-print-order .print-table-no {
  449. width: 100%;
  450. text-align: center;
  451. border-collapse: collapse;
  452. font-size: 14px;
  453. }
  454. .dialysis-print-order .under-line {
  455. border-bottom: 1px solid #999;
  456. width: 95%;
  457. text-align: center;
  458. margin-left: 2px;
  459. }
  460. .dialysis-print-order .title-box {
  461. text-align: center;
  462. font-size: 16px;
  463. }
  464. .dialysis-print-order .radio-lebel-box {
  465. font-weight: 400;
  466. cursor: pointer;
  467. }
  468. .dialysis-print-order .radio-no {
  469. opacity: 0;
  470. outline: none;
  471. position: absolute;
  472. margin: 0;
  473. width: 0;
  474. height: 0;
  475. z-index: -1;
  476. }
  477. .dialysis-print-order .radio-inner {
  478. white-space: nowrap;
  479. cursor: pointer;
  480. outline: none;
  481. display: inline-block;
  482. line-height: 1;
  483. position: relative;
  484. vertical-align: middle;
  485. }
  486. .dialysis-print-order .radio-fang {
  487. display: inline-block;
  488. position: relative;
  489. border: 1px solid #000;
  490. box-sizing: border-box;
  491. width: 14px;
  492. height: 14px;
  493. background-color: #fff;
  494. z-index: 1;
  495. transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46);
  496. }
  497. .dialysis-print-order .is-checked-radio::after {
  498. content: "√";
  499. font-size: 15px;
  500. }
  501. .dialysis-print-order .print-table-no tr td {
  502. padding: 8px 5px;
  503. line-height: 25px;
  504. }
  505. .dialysis-print-order .print-table tr td {
  506. padding: 1px 1px;
  507. /*line-height: 25px;*/
  508. }
  509. .es-img {
  510. height: 25px;
  511. }
  512. .advice-name {
  513. text-align: left;
  514. }
  515. .advice-children {
  516. display: flex;
  517. }
  518. .title-box-pro {
  519. border: 0 #fff;
  520. line-height: 25px;
  521. height: 25px;
  522. text-align: left;
  523. padding-left: 10px !important;
  524. }
  525. .title-box-pro-tr {
  526. border: 0 #fff;
  527. }
  528. .text-align-left {
  529. text-align: left !important;
  530. padding-left: 10px !important;
  531. font-size: 14px !important;
  532. line-height: 25px;
  533. }
  534. .print-table-tr-new td {
  535. line-height: 20px !important;
  536. }
  537. .border-top-solid {
  538. border: solid 1px #000;
  539. }
  540. .print-template-two tr {
  541. line-height: 30px;
  542. }
  543. </style>