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

print.vue 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  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">
  50. <span v-if="org_id == 10090">{{getWareOut(stock.id)}}</span>
  51. <span else>{{getStockCount(stock.id)}}</span>
  52. </span>
  53. <span v-else>{{calCount(stock)}}</span>
  54. </td>
  55. <td style="line-height:50px" v-if="type == 1 && stock.query_warehousing_info.length > 0">{{stock.query_warehousing_info[0].price}}</td>
  56. <td style="line-height:50px" v-if="type == 3 && stock.query_warehouseout_info.length > 0">
  57. <!-- {{stock.query_warehouseout_info[0].price}} -->
  58. {{getReailPrice(stock.id)}}
  59. </td>
  60. <td style="line-height: 50px" v-if="type == 1">{{calTotal(stock)}}</td>
  61. <td style="line-height: 50px" v-if="type == 3">
  62. <span v-if="org_id == 10090">{{getPrice(stock.id)}}</span>
  63. <span v-else>{{(getStockCount(stock.id) * getReailPrice(stock.id)).toFixed(2)}}</span>
  64. </td>
  65. <td style="line-height: 50px"></td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. <table class="print-table" border="1" v-if="type == 1 || type == 3">
  70. <tbody>
  71. <tr>
  72. <td width="633" style="line-height: 50px">合计</td>
  73. <td width="80" style="line-height: 50px">
  74. <span v-if="type == 1">{{calTotalPrice()}}</span>
  75. <span v-if="type == 3 && org_id!=10090">{{getTotalPrice().toFixed(2)}}</span>
  76. <span v-if="type == 3 && org_id==10090">{{getTotalPriceOne().toFixed(2)}}</span>
  77. </td>
  78. <td></td>
  79. </tr>
  80. </tbody>
  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 } 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. },
  118. totalPrice: 0,
  119. stockDatas: [],
  120. goodUnit: [],
  121. type: this.$route.query.type,
  122. start_time: this.$route.query.start_time,
  123. end_time: this.$route.query.end_time,
  124. stockTotal:[],
  125. wareOutInfo:[],
  126. org_id:0,
  127. informationList:[]
  128. }
  129. },
  130. methods: {
  131. getDateOne(){
  132. if (this.type == 1){
  133. return "入库日期: "+this.start_time +"~"+this.end_time
  134. }else if(this.type == 2){
  135. return "退货日期: "+this.start_time +"~"+this.end_time
  136. }else if(this.type == 3){
  137. return "出库日期: "+this.start_time +"~"+this.end_time
  138. }else if(this.type == 4){
  139. return "退库日期: "+this.start_time +"~"+this.end_time
  140. }
  141. },
  142. getDateTwo(){
  143. var ptime = Math.round(new Date().getTime() / 1000)
  144. return "印单日期:"+uParseTime(ptime, '{y}-{m}-{d}')
  145. },
  146. getTime(value, temp) {
  147. if (value == 0) {
  148. return ''
  149. }
  150. if (value != undefined) {
  151. return uParseTime(value, temp)
  152. }
  153. return ''
  154. },
  155. printThisPage() {
  156. var ptime = Math.round(new Date().getTime() / 1000)
  157. this.print_time = uParseTime(ptime, '{y}-{m}-{d} {h}:{i}')
  158. 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;}'
  159. printJS({
  160. printable: 'dialysis-print-box',
  161. type: 'html',
  162. style: style,
  163. scanStyles: false
  164. })
  165. },
  166. getDialysisRecord() {
  167. this.loading = true
  168. getPrintStockGood(this.queryParams).then(response => {
  169. if (response.data.state == 1) {
  170. var stockTotal = response.data.data.stockTotal
  171. this.stockTotal = stockTotal
  172. var info = response.data.data.info
  173. this.wareOutInfo = info
  174. var org_id = response.data.data.orgid
  175. this.org_id = org_id
  176. var informationlist = response.data.data.infomationList
  177. this.informationList = informationlist
  178. this.stockDatas = []
  179. for (let i = 0; i < response.data.data.list.length; i++) {
  180. if (this.type == 1) {
  181. if (response.data.data.list[i].query_warehousing_info.length > 0) {
  182. this.stockDatas.push(response.data.data.list[i])
  183. }
  184. console.log("入库打印数据源",this.stockDatas)
  185. } else if (this.type == 2) {
  186. if (response.data.data.list[i].query_sales_return_info.length > 0) {
  187. this.stockDatas.push(response.data.data.list[i])
  188. }
  189. } else if (this.type == 3) {
  190. if (response.data.data.list[i].query_warehouseout_info.length > 0) {
  191. this.stockDatas.push(response.data.data.list[i])
  192. }
  193. console.log("出库打印数据源",this.stockDatas)
  194. } else if (this.type == 4) {
  195. if (response.data.data.list[i].query_cancel_stock_info.length > 0) {
  196. this.stockDatas.push(response.data.data.list[i])
  197. }
  198. }
  199. }
  200. var obj = null
  201. for(let i = 0; i <this.stockDatas.length;i++){
  202. obj = this.stockDatas[i]
  203. }
  204. console.log("9999999",this.stockDatas)
  205. var newArr = this.unique(this.stockDatas)
  206. console.log("耗材出库去重",newArr)
  207. this.stockDatas = newArr
  208. // if (this.stockDatas.length < 50) {
  209. // var nl = 50 - this.stockDatas.length
  210. // for (let index = 0; index < nl; index++) {
  211. // this.stockDatas.push([])
  212. // }
  213. // }
  214. this.loading = false
  215. } else {
  216. this.loading = false
  217. this.$message.error('请求数据失败')
  218. return false
  219. }
  220. })
  221. },
  222. calCount(stock) {
  223. let total = 0
  224. var array = []
  225. if (this.type == 1) {
  226. array = stock.query_warehousing_info
  227. } else if (this.type == 2) {
  228. array = stock.query_sales_return_info
  229. } else if (this.type == 3) {
  230. array = stock.query_warehouseout_info
  231. } else if (this.type == 4) {
  232. array = stock.query_cancel_stock_info
  233. }
  234. for (let i = 0; i < array.length; i++) {
  235. if (this.type == 1) {
  236. total = total + array[i].warehousing_count
  237. } else if (this.type == 2) {
  238. total = total + array[i].count
  239. } else if (this.type == 3) {
  240. total = total + array[i].count
  241. } else if (this.type == 4) {
  242. total = total + array[i].count
  243. }
  244. }
  245. return total
  246. }, calTotal(stock) {
  247. console.log(stock)
  248. var array = []
  249. if (this.type == 1) {
  250. array = stock.query_warehousing_info
  251. } else if (this.type == 3) {
  252. array = stock.query_warehouseout_info
  253. }
  254. let total_price = 0.0
  255. for (let i = 0; i < array.length; i++) {
  256. if(this.type == 1) {
  257. total_price = total_price + array[i].warehousing_count * array[i].price
  258. }else if(this.type == 3){
  259. total_price = total_price + array[i].count * array[i].price
  260. }
  261. }
  262. return Math.floor(total_price * 100) / 100
  263. },
  264. calTotalPrice() {
  265. var amountPrice = 0
  266. for (let i = 0; i < this.stockDatas.length; i++) {
  267. var obj = this.stockDatas[i]
  268. var len = 0
  269. if (this.type == 1) {
  270. len = obj.query_warehousing_info.length
  271. } else if (this.type == 3) {
  272. len = obj.query_warehouseout_info.length
  273. }
  274. let total_price = 0.0
  275. for (let a = 0; a < len; a++) {
  276. if (this.type == 1) {
  277. total_price = total_price + obj.query_warehousing_info[a].total_price
  278. } else if (this.type == 3) {
  279. total_price = total_price + obj.query_warehouseout_info[a].total_price
  280. }
  281. }
  282. amountPrice = amountPrice + Math.floor(total_price* 100) / 100
  283. }
  284. return Math.floor(amountPrice* 100) / 100
  285. }, getTotal: function(price, total) {
  286. var m = 0, r1, r2
  287. var s1 = price.toString()
  288. var s2 = total.toString()
  289. try {
  290. m += s1.split('.')[1].length
  291. } catch (e) {
  292. }
  293. try {
  294. } catch (e) {
  295. m += s2.split('.')[1].length
  296. }
  297. r1 = Number(price.toString().replace('.', ''))
  298. r2 = Number(total.toString().replace('.', ''))
  299. return r1 * r2 / Math.pow(10, m)
  300. },
  301. getUnit(id){
  302. var name = ""
  303. for(let i=0;i<this.goodUnit.length;i++){
  304. if(this.goodUnit[i].id == id){
  305. name = this.goodUnit[i].name
  306. }
  307. }
  308. return name
  309. },
  310. getStockCount(id){
  311. var count = ""
  312. for(let i=0;i<this.stockTotal.length;i++){
  313. if(id == this.stockTotal[i].good_id){
  314. count = this.stockTotal[i].count
  315. }
  316. }
  317. return count
  318. },
  319. getWareOut(id){
  320. var count = ""
  321. for(let i=0;i<this.wareOutInfo.length;i++){
  322. if(id == this.wareOutInfo[i].good_id){
  323. count = this.wareOutInfo[i].count
  324. }
  325. }
  326. return count
  327. },
  328. getPrice(id){
  329. var sum = ""
  330. for(let i=0;i<this.informationList.length;i++){
  331. for(let j=0;j<this.wareOutInfo.length;j++){
  332. if(this.informationList[i].id == this.wareOutInfo[j].good_id){
  333. this.wareOutInfo[j].buy_price = this.informationList[i].buy_price
  334. }
  335. }
  336. }
  337. for(let j=0;j<this.wareOutInfo.length;j++){
  338. if(id == this.wareOutInfo[j].good_id){
  339. sum += (this.wareOutInfo[j].buy_price * this.wareOutInfo[j].count).toFixed(2)
  340. }
  341. }
  342. return sum
  343. },
  344. getReailPrice(id){
  345. var price = 0
  346. for(let i=0;i<this.informationList.length;i++){
  347. if(id == this.informationList[i].id){
  348. price = this.informationList[i].buy_price
  349. }
  350. }
  351. return price
  352. },
  353. getTotalPrice(){
  354. var total_price = 0
  355. for(let i=0;i<this.stockDatas.length;i++){
  356. total_price += (this.getStockCount(this.stockDatas[i].id) * this.getReailPrice(this.stockDatas[i].id))
  357. }
  358. return total_price
  359. },
  360. getTotalPriceOne(){
  361. var total_price = 0
  362. for(let i=0;i<this.stockDatas.length;i++){
  363. total_price +=(this.getWareOut(this.stockDatas[i].id) * this.getReailPrice(this.stockDatas[i].id))
  364. }
  365. return total_price
  366. },
  367. unique(arr) {
  368. const res = new Map();
  369. return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1));
  370. },
  371. },
  372. created() {
  373. var xtuser = this.$store.getters.xt_user
  374. this.orgname = xtuser.org.org_name
  375. this.goodUnit = this.$store.getters.good_unit
  376. this.getDialysisRecord()
  377. }
  378. }
  379. </script>
  380. <style>
  381. .dialysis-print-order {
  382. width: 960px;
  383. margin: 0 auto
  384. }
  385. .dialysis-print-order .order-yy-name {
  386. margin: auto;
  387. text-align: center;
  388. font-size: 20px;
  389. letter-spacing: 5px;
  390. }
  391. .dialysis-print-order .order-title {
  392. margin: auto;
  393. font-weight: 600;
  394. text-align: center;
  395. font-size: 22px;
  396. padding: 10px 20px 20px 20px;
  397. }
  398. .dialysis-print-order .table-box {
  399. width: 100%;
  400. line-height: 23px;
  401. font-size: 14px;
  402. }
  403. .dialysis-print-order .print-table {
  404. width: 100%;
  405. text-align: center;
  406. border-collapse: collapse;
  407. line-height: 40px;
  408. font-size: 14px;
  409. }
  410. .dialysis-print-order .print-table-no {
  411. width: 100%;
  412. text-align: center;
  413. border-collapse: collapse;
  414. font-size: 14px;
  415. }
  416. .dialysis-print-order .under-line {
  417. border-bottom: 1px solid #999;
  418. width: 95%;
  419. text-align: center;
  420. margin-left: 2px;
  421. }
  422. .dialysis-print-order .title-box {
  423. text-align: center;
  424. font-size: 16px;
  425. }
  426. .dialysis-print-order .radio-lebel-box {
  427. font-weight: 400;
  428. cursor: pointer;
  429. }
  430. .dialysis-print-order .radio-no {
  431. opacity: 0;
  432. outline: none;
  433. position: absolute;
  434. margin: 0;
  435. width: 0;
  436. height: 0;
  437. z-index: -1;
  438. }
  439. .dialysis-print-order .radio-inner {
  440. white-space: nowrap;
  441. cursor: pointer;
  442. outline: none;
  443. display: inline-block;
  444. line-height: 1;
  445. position: relative;
  446. vertical-align: middle;
  447. }
  448. .dialysis-print-order .radio-fang {
  449. display: inline-block;
  450. position: relative;
  451. border: 1px solid #000;
  452. box-sizing: border-box;
  453. width: 14px;
  454. height: 14px;
  455. background-color: #fff;
  456. z-index: 1;
  457. transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46);
  458. }
  459. .dialysis-print-order .is-checked-radio::after {
  460. content: "√";
  461. font-size: 15px;
  462. }
  463. .dialysis-print-order .print-table-no tr td {
  464. padding: 8px 5px;
  465. line-height: 25px;
  466. }
  467. .dialysis-print-order .print-table tr td {
  468. padding: 1px 1px;
  469. /*line-height: 25px;*/
  470. }
  471. .es-img {
  472. height: 25px;
  473. }
  474. .advice-name {
  475. text-align: left;
  476. }
  477. .advice-children {
  478. display: flex;
  479. }
  480. .title-box-pro {
  481. border: 0 #fff;
  482. line-height: 25px;
  483. height: 25px;
  484. text-align: left;
  485. padding-left: 10px !important;
  486. }
  487. .title-box-pro-tr {
  488. border: 0 #fff;
  489. }
  490. .text-align-left {
  491. text-align: left !important;
  492. padding-left: 10px !important;
  493. font-size: 14px !important;
  494. line-height: 25px;
  495. }
  496. .print-table-tr-new td {
  497. line-height: 20px !important;
  498. }
  499. .border-top-solid {
  500. border: solid 1px #000;
  501. }
  502. .print-template-two tr {
  503. line-height: 30px;
  504. }
  505. </style>