print.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  6. <title></title>
  7. <style>
  8. .content {
  9. text-align: center;
  10. display: flex;
  11. align-items: center;
  12. justify-content: center;
  13. flex-direction: column;
  14. }
  15. .title {
  16. width: 600px;
  17. position: relative;
  18. /* border-top: 1px solid #EBEEF5;
  19. border-left: 1px solid #EBEEF5;
  20. border-right: 1px solid #EBEEF5; */
  21. /* padding: 20px; */
  22. box-sizing: border-box;
  23. display: flex;
  24. justify-content: center;
  25. align-items: center;
  26. }
  27. .name {
  28. font-size: 16px;
  29. font-weight: 500;
  30. color: #323233;
  31. margin: 10px;
  32. }
  33. .price {
  34. /* position: absolute;
  35. right: 10px;
  36. bottom: 0;
  37. margin: auto;
  38. font-size: 14px;
  39. top: 0;
  40. display: flex;
  41. align-items: center; */
  42. }
  43. .tableBox {
  44. width: 80px;
  45. border-left: 1px solid #ccc;
  46. /* border-right: 1px solid #ccc; */
  47. }
  48. .tableBox tr {
  49. font-size: 12px;
  50. padding: 0 !important;
  51. display: flow-root;
  52. /* border-left:1px solid #ccc; */
  53. /* border-right:1px solid #ccc;*/
  54. border-bottom:1px solid #ccc;
  55. display: flex;
  56. justify-content: space-between;
  57. padding-right: 10px;
  58. }
  59. .tableBox td {
  60. font-size: 12px;
  61. padding: 0 !important;
  62. }
  63. .tableBox .cell {
  64. text-align: center;
  65. padding: 0!important;
  66. line-height: 22px;
  67. /* margin:0 2px!important; */
  68. }
  69. .table-row{
  70. display: flex;
  71. border-top: 1px solid #ccc;
  72. }
  73. .el-table--scrollable-x .el-table__body-wrapper{
  74. overflow: hidden!important;
  75. }
  76. .el-table td.el-table__cell, .el-table th.el-table__cell.is-leaf {
  77. border: 0;
  78. padding: 0;
  79. text-overflow: initial;
  80. border-right: 1px solid #ccc;
  81. }
  82. .el-table__row td:nth-of-type(1){
  83. width: 40%;
  84. /* border-right: 1px solid #ccc!important; */
  85. background: #cccccc3d;
  86. }
  87. .el-table__row td:nth-of-type(2){
  88. width: 60%;
  89. }
  90. .el-table::before {
  91. left: 0;
  92. bottom: 0;
  93. width: 100%;
  94. height: 0px;
  95. }
  96. .content0{
  97. /* margin-bottom: 30vh; */
  98. /* padding-top: 5vh; */
  99. /* background-color: powderblue; */
  100. }
  101. .content1{
  102. /* margin-bottom: 20vh; */
  103. /* padding-top: 5vh; */
  104. margin-top: 15vh;
  105. /* background: palegreen; */
  106. }
  107. .content2{
  108. /* padding-top: 5vh; */
  109. /* margin-bottom: 30vh; */
  110. margin-top: 15vh;
  111. /* background: yellow; */
  112. }
  113. .content3{
  114. /* padding-top: 10px; */
  115. margin-top: 15vh;
  116. /* background-color: red; */
  117. }
  118. .has-gutter th:nth-of-type(1){
  119. width: 40%;
  120. }
  121. .has-gutter th:nth-of-type(2){
  122. width: 60%;
  123. }
  124. .tableBox7 tr{
  125. border-right: 1px solid #ccc!important;
  126. }
  127. </style>
  128. </head>
  129. <body>
  130. <div id="app">
  131. <div class="content" :class="'content'+index" v-for="(item,index) in 4">
  132. <div class="title">
  133. <div class="name" v-if="index==0">一等单价 {{name}}价格对照表(按水分)</div>
  134. <div class="name" v-if="index==1">二等单价 {{name}}价格对照表(按水分)</div>
  135. <div class="name" v-if="index==2">三等单价 {{name}}价格对照表(按水分)</div>
  136. <div class="name" v-if="index==3">等外单价 {{name}}价格对照表(按水分)</div>
  137. <div class="price">价格单位:元/公斤</div>
  138. </div>
  139. <div class="table-row" >
  140. <el-table :data="tableData1" :row-class-name="tableRowClassName" class="tableBox">
  141. <el-table-column prop="waterMin" label="水分" header-align="center">
  142. </el-table-column>
  143. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  144. </el-table-column> -->
  145. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  146. </el-table-column>
  147. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  148. </el-table-column>
  149. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  150. </el-table-column>
  151. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  152. </el-table-column>
  153. </el-table>
  154. <el-table :data="tableData2" :row-class-name="tableRowClassName" class="tableBox">
  155. <el-table-column prop="waterMin" label="水分" header-align="center">
  156. </el-table-column>
  157. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  158. </el-table-column> -->
  159. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  160. </el-table-column>
  161. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  162. </el-table-column>
  163. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  164. </el-table-column>
  165. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  166. </el-table-column>
  167. </el-table>
  168. <el-table :data="tableData3" :row-class-name="tableRowClassName" class="tableBox">
  169. <el-table-column prop="waterMin" label="水分" header-align="center">
  170. </el-table-column>
  171. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  172. </el-table-column> -->
  173. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  174. </el-table-column>
  175. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  176. </el-table-column>
  177. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  178. </el-table-column>
  179. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  180. </el-table-column>
  181. </el-table>
  182. <el-table :data="tableData4" :row-class-name="tableRowClassName" class="tableBox">
  183. <el-table-column prop="waterMin" label="水分" header-align="center">
  184. </el-table-column>
  185. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  186. </el-table-column> -->
  187. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  188. </el-table-column>
  189. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  190. </el-table-column>
  191. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  192. </el-table-column>
  193. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  194. </el-table-column>
  195. </el-table>
  196. <el-table :data="tableData5" :row-class-name="tableRowClassName" class="tableBox">
  197. <el-table-column prop="waterMin" label="水分" header-align="center">
  198. </el-table-column>
  199. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  200. </el-table-column> -->
  201. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  202. </el-table-column>
  203. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  204. </el-table-column>
  205. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  206. </el-table-column>
  207. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  208. </el-table-column>
  209. </el-table>
  210. <el-table :data="tableData6" :row-class-name="tableRowClassName" class="tableBox">
  211. <el-table-column prop="waterMin" label="水分" header-align="center">
  212. </el-table-column>
  213. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  214. </el-table-column> -->
  215. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  216. </el-table-column>
  217. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  218. </el-table-column>
  219. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  220. </el-table-column>
  221. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  222. </el-table-column>
  223. </el-table>
  224. <el-table :data="tableData7" :row-class-name="tableRowClassName" class="tableBox tableBox7">
  225. <el-table-column prop="waterMin" label="水分" header-align="center">
  226. </el-table-column>
  227. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  228. </el-table-column> -->
  229. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  230. </el-table-column>
  231. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  232. </el-table-column>
  233. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  234. </el-table-column>
  235. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  236. </el-table-column>
  237. </el-table>
  238. </div>
  239. </div>
  240. </div>
  241. </body>
  242. <script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
  243. <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  244. <script type="text/javascript">
  245. new Vue({
  246. el: '#app',
  247. data: {
  248. tableData: [],
  249. tableData1: [],
  250. tableData2: [],
  251. tableData3: [],
  252. tableData4: [],
  253. tableData5: [],
  254. tableData6: [],
  255. tableData7: [],
  256. name: "",
  257. waterMin: '',
  258. waterMax: ''
  259. },
  260. computed: {},
  261. methods: {
  262. tableRowClassName({
  263. row,
  264. rowIndex
  265. }) {
  266. if (rowIndex === 1) {
  267. return 'warning-row';
  268. } else if (rowIndex === 3) {
  269. return 'success-row';
  270. }
  271. return '';
  272. },
  273. getQueryVariable(variable) {
  274. var query = window.location.search.substring(1);
  275. var vars = query.split("&");
  276. for (var i = 0; i < vars.length; i++) {
  277. var pair = vars[i].split("=");
  278. if (pair[0] == variable) {
  279. return pair[1];
  280. }
  281. }
  282. return (false);
  283. }
  284. },
  285. mounted() {
  286. let _data = localStorage.getItem("pricePrintList")
  287. this.name = decodeURIComponent(this.getQueryVariable("name"))
  288. console.log(_data)
  289. this.tableData = JSON.parse(_data)
  290. // 构造显示数据
  291. this.waterMin = this.tableData[0].waterMin
  292. this.waterMax = this.tableData[0].waterMax
  293. document.title = this.name + '价格对照表(按水分)'
  294. for (let i = 0; i < this.tableData.length; i++) {
  295. // if(!this.tableData[i].waterMin.toString().split(".")[1]){
  296. // this.tableData[i].waterMin = this.tableData[i].waterMin+'.0'
  297. // }
  298. if (i <= 39) {
  299. this.tableData1.push(this.tableData[i])
  300. } else if (i <= 79 && i > 39) {
  301. this.tableData2.push(this.tableData[i])
  302. }
  303. else if (i <= 119 && i > 79) {
  304. this.tableData3.push(this.tableData[i])
  305. }
  306. else if (i <= 159 && i > 119) {
  307. this.tableData4.push(this.tableData[i])
  308. }
  309. else if (i <= 199 && i > 159) {
  310. this.tableData5.push(this.tableData[i])
  311. }
  312. else if (i <= 239 && i > 199) {
  313. this.tableData6.push(this.tableData[i])
  314. }
  315. else if (i <= 279 && i > 239) {
  316. this.tableData7.push(this.tableData[i])
  317. }
  318. }
  319. // window.print()
  320. window.onafterprint = function (event) {
  321. window.history.back(-1)
  322. };
  323. },
  324. watch: {
  325. }
  326. })
  327. </script>
  328. </html>