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

print.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  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 == 3">出库单</div>
  15. <div class="order-title" v-if="type == 4">退库单</div>
  16. <div style="float: left;margin-bottom: 10px;">{{getDateOne()}}</div>
  17. <div style="float: right;margin-bottom: 10px;">{{getDateTwo()}}</div>
  18. <table class="print-table" border="1">
  19. <tbody>
  20. <tr>
  21. <td style="line-height: 50px" width="50">序号</td>
  22. <td style="line-height: 50px" width="250">耗材名称</td>
  23. <td style="line-height: 50px" width="250">规格型号</td>
  24. <td style="line-height: 50px" width="50">单位</td>
  25. <!-- <td style="line-height: 50px" width="250">耗材类型</td> -->
  26. <td style="line-height: 50px" width="80">数量</td>
  27. <td style="line-height:50px" width="80" v-if="type == 1">进货价</td>
  28. <td style="line-height:50px" width="80" v-if="type == 3">出货价</td>
  29. <td style="line-height: 50px" width="80" v-if="type == 1 || type == 3">总价</td>
  30. <td style="line-height: 50px" width="">备 注</td>
  31. </tr>
  32. <tr v-for="(stock,index) in stockDatas" :key="stock.id">
  33. <td style="line-height: 50px">&nbsp;
  34. {{index+1}}
  35. </td>
  36. <td style="line-height: 50px">
  37. <span>{{stock.good_name}}</span>
  38. </td>
  39. <td style="line-height: 50px">
  40. <span v-if="stock">{{stock.specification_name}}</span>
  41. </td>
  42. <td style="line-height: 50px">
  43. <span>{{getUnit(stock.good_unit)}}</span>
  44. </td>
  45. <!-- <td style="line-height: 50px">
  46. <span v-if="stock.type && stock.type.type_name.length > 0">{{stock.type.type_name}}</span>
  47. </td> -->
  48. <td style="line-height: 50px">
  49. <span v-if="type == 3">{{getStockCount(stock.id)}}</span>
  50. <span v-else>{{calCount(stock)}}</span>
  51. </td>
  52. <td style="line-height:50px" v-if="type == 1 && stock.query_warehousing_info.length > 0">{{stock.query_warehousing_info[0].price}}</td>
  53. <td style="line-height:50px" v-if="type == 3 && stock.query_warehouseout_info.length > 0">{{stock.query_warehouseout_info[0].price}}</td>
  54. <td style="line-height: 50px" v-if="type == 1">{{calTotal(stock)}}</td>
  55. <td style="line-height: 50px" v-if="type == 3">{{(getStockCount(stock.id) * stock.query_warehouseout_info[0].price).toFixed(2)}}</td>
  56. <td style="line-height: 50px"></td>
  57. </tr>
  58. </tbody>
  59. </table>
  60. <table class="print-table" border="1" v-if="type == 1 || type == 3">
  61. <tbody>
  62. <tr>
  63. <td width="633" style="line-height: 50px">合计</td>
  64. <td width="80" style="line-height: 50px">{{calTotalPrice()}}</td>
  65. <td></td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </template>
  74. <script>
  75. import { getPrintStockGood } from '@/api/stock'
  76. import { getDataConfig } from '@/utils/data'
  77. import { jsGetAge, uParseTime } from '@/utils/tools'
  78. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  79. import print from 'print-js'
  80. export default {
  81. name: 'dialysisPrintOrder',
  82. components: {
  83. BreadCrumb
  84. },
  85. data() {
  86. return {
  87. crumbs: [
  88. { path: false, name: '出入库明细' },
  89. { path: false, name: '打印单' }
  90. ],
  91. loading: false,
  92. orgname: '',
  93. queryParams: {
  94. start_time: this.$route.query.start_time,
  95. end_time: this.$route.query.end_time,
  96. type: this.$route.query.type
  97. },
  98. totalPrice: 0,
  99. stockDatas: [],
  100. goodUnit: [],
  101. type: this.$route.query.type,
  102. start_time: this.$route.query.start_time,
  103. end_time: this.$route.query.end_time,
  104. stockTotal:[]
  105. }
  106. },
  107. methods: {
  108. getDateOne(){
  109. if (this.type == 1){
  110. return "入库日期: "+this.start_time +"~"+this.end_time
  111. }else if(this.type == 2){
  112. return "退货日期: "+this.start_time +"~"+this.end_time
  113. }else if(this.type == 3){
  114. return "出库日期: "+this.start_time +"~"+this.end_time
  115. }else if(this.type == 4){
  116. return "退库日期: "+this.start_time +"~"+this.end_time
  117. }
  118. },
  119. getDateTwo(){
  120. var ptime = Math.round(new Date().getTime() / 1000)
  121. return "印单日期:"+uParseTime(ptime, '{y}-{m}-{d}')
  122. },
  123. getTime(value, temp) {
  124. if (value == 0) {
  125. return ''
  126. }
  127. if (value != undefined) {
  128. return uParseTime(value, temp)
  129. }
  130. return ''
  131. },
  132. printThisPage() {
  133. var ptime = Math.round(new Date().getTime() / 1000)
  134. this.print_time = uParseTime(ptime, '{y}-{m}-{d} {h}:{i}')
  135. 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;}'
  136. printJS({
  137. printable: 'dialysis-print-box',
  138. type: 'html',
  139. style: style,
  140. scanStyles: false
  141. })
  142. },
  143. getDialysisRecord() {
  144. this.loading = true
  145. getPrintStockGood(this.queryParams).then(response => {
  146. if (response.data.state == 1) {
  147. var stockTotal = response.data.data.stockTotal
  148. console.log("stocktOTl",stockTotal)
  149. this.stockTotal = stockTotal
  150. for (let i = 0; i < response.data.data.list.length; i++) {
  151. if (this.type == 1) {
  152. if (response.data.data.list[i].query_warehousing_info.length > 0) {
  153. this.stockDatas.push(response.data.data.list[i])
  154. }
  155. } else if (this.type == 2) {
  156. if (response.data.data.list[i].query_sales_return_info.length > 0) {
  157. this.stockDatas.push(response.data.data.list[i])
  158. }
  159. } else if (this.type == 3) {
  160. if (response.data.data.list[i].query_warehouseout_info.length > 0) {
  161. this.stockDatas.push(response.data.data.list[i])
  162. }
  163. } else if (this.type == 4) {
  164. if (response.data.data.list[i].query_cancel_stock_info.length > 0) {
  165. this.stockDatas.push(response.data.data.list[i])
  166. }
  167. }
  168. }
  169. var obj = null
  170. for(let i = 0; i <this.stockDatas.length;i++){
  171. obj = this.stockDatas[i]
  172. }
  173. console.log("9999999",this.stockDatas)
  174. // if (this.stockDatas.length < 50) {
  175. // var nl = 50 - this.stockDatas.length
  176. // for (let index = 0; index < nl; index++) {
  177. // this.stockDatas.push([])
  178. // }
  179. // }
  180. this.loading = false
  181. } else {
  182. this.loading = false
  183. this.$message.error('请求数据失败')
  184. return false
  185. }
  186. })
  187. }, calCount(stock) {
  188. let total = 0
  189. var array = []
  190. if (this.type == 1) {
  191. array = stock.query_warehousing_info
  192. } else if (this.type == 2) {
  193. array = stock.query_sales_return_info
  194. } else if (this.type == 3) {
  195. array = stock.query_warehouseout_info
  196. } else if (this.type == 4) {
  197. array = stock.query_cancel_stock_info
  198. }
  199. for (let i = 0; i < array.length; i++) {
  200. if (this.type == 1) {
  201. total = total + array[i].warehousing_count
  202. } else if (this.type == 2) {
  203. total = total + array[i].count
  204. } else if (this.type == 3) {
  205. total = total + array[i].count
  206. } else if (this.type == 4) {
  207. total = total + array[i].count
  208. }
  209. }
  210. return total
  211. }, calTotal(stock) {
  212. console.log(stock)
  213. var array = []
  214. if (this.type == 1) {
  215. array = stock.query_warehousing_info
  216. } else if (this.type == 3) {
  217. array = stock.query_warehouseout_info
  218. }
  219. let total_price = 0.0
  220. for (let i = 0; i < array.length; i++) {
  221. if(this.type == 1) {
  222. total_price = total_price + array[i].warehousing_count * array[i].price
  223. }else if(this.type == 3){
  224. total_price = total_price + array[i].count * array[i].price
  225. }
  226. }
  227. return Math.floor(total_price * 100) / 100
  228. }, calTotalPrice() {
  229. var amountPrice = 0
  230. for (let i = 0; i < this.stockDatas.length; i++) {
  231. var obj = this.stockDatas[i]
  232. var len = 0
  233. if (this.type == 1) {
  234. len = obj.query_warehousing_info.length
  235. } else if (this.type == 3) {
  236. len = obj.query_warehouseout_info.length
  237. }
  238. let total_price = 0.0
  239. for (let a = 0; a < len; a++) {
  240. if (this.type == 1) {
  241. total_price = total_price + obj.query_warehousing_info[a].total_price
  242. } else if (this.type == 3) {
  243. total_price = total_price + obj.query_warehouseout_info[a].total_price
  244. }
  245. }
  246. amountPrice = amountPrice + Math.floor(total_price* 100) / 100
  247. }
  248. return Math.floor(amountPrice* 100) / 100
  249. }, getTotal: function(price, total) {
  250. var m = 0, r1, r2
  251. var s1 = price.toString()
  252. var s2 = total.toString()
  253. try {
  254. m += s1.split('.')[1].length
  255. } catch (e) {
  256. }
  257. try {
  258. } catch (e) {
  259. m += s2.split('.')[1].length
  260. }
  261. r1 = Number(price.toString().replace('.', ''))
  262. r2 = Number(total.toString().replace('.', ''))
  263. return r1 * r2 / Math.pow(10, m)
  264. },
  265. getUnit(id){
  266. var name = ""
  267. for(let i=0;i<this.goodUnit.length;i++){
  268. if(this.goodUnit[i].id == id){
  269. name = this.goodUnit[i].name
  270. }
  271. }
  272. return name
  273. },
  274. getStockCount(id){
  275. var count = ""
  276. for(let i=0;i<this.stockTotal.length;i++){
  277. if(id == this.stockTotal[i].good_id){
  278. count = this.stockTotal[i].count
  279. }
  280. }
  281. return count
  282. }
  283. },
  284. created() {
  285. var xtuser = this.$store.getters.xt_user
  286. this.orgname = xtuser.org.org_name
  287. this.goodUnit = this.$store.getters.good_unit
  288. this.getDialysisRecord()
  289. }
  290. }
  291. </script>
  292. <style>
  293. .dialysis-print-order {
  294. width: 960px;
  295. margin: 0 auto
  296. }
  297. .dialysis-print-order .order-yy-name {
  298. margin: auto;
  299. text-align: center;
  300. font-size: 20px;
  301. letter-spacing: 5px;
  302. }
  303. .dialysis-print-order .order-title {
  304. margin: auto;
  305. font-weight: 600;
  306. text-align: center;
  307. font-size: 22px;
  308. padding: 10px 20px 20px 20px;
  309. }
  310. .dialysis-print-order .table-box {
  311. width: 100%;
  312. line-height: 23px;
  313. font-size: 14px;
  314. }
  315. .dialysis-print-order .print-table {
  316. width: 100%;
  317. text-align: center;
  318. border-collapse: collapse;
  319. line-height: 40px;
  320. font-size: 14px;
  321. }
  322. .dialysis-print-order .print-table-no {
  323. width: 100%;
  324. text-align: center;
  325. border-collapse: collapse;
  326. font-size: 14px;
  327. }
  328. .dialysis-print-order .under-line {
  329. border-bottom: 1px solid #999;
  330. width: 95%;
  331. text-align: center;
  332. margin-left: 2px;
  333. }
  334. .dialysis-print-order .title-box {
  335. text-align: center;
  336. font-size: 16px;
  337. }
  338. .dialysis-print-order .radio-lebel-box {
  339. font-weight: 400;
  340. cursor: pointer;
  341. }
  342. .dialysis-print-order .radio-no {
  343. opacity: 0;
  344. outline: none;
  345. position: absolute;
  346. margin: 0;
  347. width: 0;
  348. height: 0;
  349. z-index: -1;
  350. }
  351. .dialysis-print-order .radio-inner {
  352. white-space: nowrap;
  353. cursor: pointer;
  354. outline: none;
  355. display: inline-block;
  356. line-height: 1;
  357. position: relative;
  358. vertical-align: middle;
  359. }
  360. .dialysis-print-order .radio-fang {
  361. display: inline-block;
  362. position: relative;
  363. border: 1px solid #000;
  364. box-sizing: border-box;
  365. width: 14px;
  366. height: 14px;
  367. background-color: #fff;
  368. z-index: 1;
  369. transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46);
  370. }
  371. .dialysis-print-order .is-checked-radio::after {
  372. content: "√";
  373. font-size: 15px;
  374. }
  375. .dialysis-print-order .print-table-no tr td {
  376. padding: 8px 5px;
  377. line-height: 25px;
  378. }
  379. .dialysis-print-order .print-table tr td {
  380. padding: 1px 1px;
  381. /*line-height: 25px;*/
  382. }
  383. .es-img {
  384. height: 25px;
  385. }
  386. .advice-name {
  387. text-align: left;
  388. }
  389. .advice-children {
  390. display: flex;
  391. }
  392. .title-box-pro {
  393. border: 0 #fff;
  394. line-height: 25px;
  395. height: 25px;
  396. text-align: left;
  397. padding-left: 10px !important;
  398. }
  399. .title-box-pro-tr {
  400. border: 0 #fff;
  401. }
  402. .text-align-left {
  403. text-align: left !important;
  404. padding-left: 10px !important;
  405. font-size: 14px !important;
  406. line-height: 25px;
  407. }
  408. .print-table-tr-new td {
  409. line-height: 20px !important;
  410. }
  411. .border-top-solid {
  412. border: solid 1px #000;
  413. }
  414. .print-template-two tr {
  415. line-height: 30px;
  416. }
  417. </style>