print.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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,
  77. .el-table th.el-table__cell.is-leaf {
  78. border: 0;
  79. padding: 0;
  80. text-overflow: initial;
  81. border-right: 1px solid #ccc;
  82. }
  83. .el-table__row td:nth-of-type(1) {
  84. width: 40%;
  85. /* border-right: 1px solid #ccc!important; */
  86. background: #cccccc3d;
  87. }
  88. .el-table__row td:nth-of-type(2) {
  89. width: 60%;
  90. }
  91. .el-table::before {
  92. left: 0;
  93. bottom: 0;
  94. width: 100%;
  95. height: 0px;
  96. }
  97. .content0 {
  98. /* margin-bottom: 30vh; */
  99. /* padding-top: 5vh; */
  100. /* background-color: powderblue; */
  101. }
  102. .content1 {
  103. /* margin-bottom: 20vh; */
  104. /* padding-top: 5vh; */
  105. margin-top: 15vh;
  106. /* background: palegreen; */
  107. }
  108. .content2 {
  109. /* padding-top: 5vh; */
  110. /* margin-bottom: 30vh; */
  111. margin-top: 15vh;
  112. /* background: yellow; */
  113. }
  114. .content3 {
  115. /* padding-top: 10px; */
  116. margin-top: 15vh;
  117. /* background-color: red; */
  118. }
  119. .has-gutter th:nth-of-type(1) {
  120. width: 40%;
  121. }
  122. .has-gutter th:nth-of-type(2) {
  123. width: 60%;
  124. }
  125. .tableBox7 tr {
  126. border-right: 1px solid #ccc !important;
  127. }
  128. </style>
  129. </head>
  130. <body>
  131. <div id="app">
  132. <div class="content" :class="'content'+index" v-for="(item,index) in 4">
  133. <div class="title">
  134. <div class="name" v-if="index==0">一等单价 {{name}}价格对照表(按水分)</div>
  135. <div class="name" v-if="index==1">二等单价 {{name}}价格对照表(按水分)</div>
  136. <div class="name" v-if="index==2">三等单价 {{name}}价格对照表(按水分)</div>
  137. <div class="name" v-if="index==3">等外单价 {{name}}价格对照表(按水分)</div>
  138. <div class="price">价格单位:元/公斤</div>
  139. </div>
  140. <div class="table-row">
  141. <el-table :data="tableData1" :row-class-name="tableRowClassName" class="tableBox">
  142. <el-table-column prop="waterMin" label="水分" header-align="center">
  143. </el-table-column>
  144. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  145. </el-table-column> -->
  146. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  147. </el-table-column>
  148. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  149. </el-table-column>
  150. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  151. </el-table-column>
  152. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  153. </el-table-column>
  154. </el-table>
  155. <el-table :data="tableData2" :row-class-name="tableRowClassName" class="tableBox">
  156. <el-table-column prop="waterMin" label="水分" header-align="center">
  157. </el-table-column>
  158. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  159. </el-table-column> -->
  160. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  161. </el-table-column>
  162. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  163. </el-table-column>
  164. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  165. </el-table-column>
  166. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  167. </el-table-column>
  168. </el-table>
  169. <el-table :data="tableData3" :row-class-name="tableRowClassName" class="tableBox">
  170. <el-table-column prop="waterMin" label="水分" header-align="center">
  171. </el-table-column>
  172. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  173. </el-table-column> -->
  174. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  175. </el-table-column>
  176. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  177. </el-table-column>
  178. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  179. </el-table-column>
  180. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  181. </el-table-column>
  182. </el-table>
  183. <el-table :data="tableData4" :row-class-name="tableRowClassName" class="tableBox">
  184. <el-table-column prop="waterMin" label="水分" header-align="center">
  185. </el-table-column>
  186. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  187. </el-table-column> -->
  188. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  189. </el-table-column>
  190. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  191. </el-table-column>
  192. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  193. </el-table-column>
  194. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  195. </el-table-column>
  196. </el-table>
  197. <el-table :data="tableData5" :row-class-name="tableRowClassName" class="tableBox">
  198. <el-table-column prop="waterMin" label="水分" header-align="center">
  199. </el-table-column>
  200. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  201. </el-table-column> -->
  202. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  203. </el-table-column>
  204. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  205. </el-table-column>
  206. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  207. </el-table-column>
  208. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  209. </el-table-column>
  210. </el-table>
  211. <el-table :data="tableData6" :row-class-name="tableRowClassName" class="tableBox">
  212. <el-table-column prop="waterMin" label="水分" header-align="center">
  213. </el-table-column>
  214. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  215. </el-table-column> -->
  216. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  217. </el-table-column>
  218. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  219. </el-table-column>
  220. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  221. </el-table-column>
  222. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  223. </el-table-column>
  224. </el-table>
  225. <el-table :data="tableData7" :row-class-name="tableRowClassName" class="tableBox tableBox7">
  226. <el-table-column prop="waterMin" label="水分" header-align="center">
  227. </el-table-column>
  228. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  229. </el-table-column> -->
  230. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  231. </el-table-column>
  232. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  233. </el-table-column>
  234. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  235. </el-table-column>
  236. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  237. </el-table-column>
  238. </el-table>
  239. </div>
  240. </div>
  241. </div>
  242. </body>
  243. <script src="../cdn/vue/2.6.10/vue.min.js"></script>
  244. <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  245. <script type="text/javascript">
  246. new Vue({
  247. el: '#app',
  248. data: {
  249. tableData: [],
  250. tableData1: [],
  251. tableData2: [],
  252. tableData3: [],
  253. tableData4: [],
  254. tableData5: [],
  255. tableData6: [],
  256. tableData7: [],
  257. name: "",
  258. waterMin: '',
  259. waterMax: ''
  260. },
  261. computed: {},
  262. methods: {
  263. tableRowClassName({
  264. row,
  265. rowIndex
  266. }) {
  267. if (rowIndex === 1) {
  268. return 'warning-row';
  269. } else if (rowIndex === 3) {
  270. return 'success-row';
  271. }
  272. return '';
  273. },
  274. getQueryVariable(variable) {
  275. var query = window.location.search.substring(1);
  276. var vars = query.split("&");
  277. for (var i = 0; i < vars.length; i++) {
  278. var pair = vars[i].split("=");
  279. if (pair[0] == variable) {
  280. return pair[1];
  281. }
  282. }
  283. return (false);
  284. }
  285. },
  286. mounted() {
  287. let _data = localStorage.getItem("pricePrintList")
  288. this.name = decodeURIComponent(this.getQueryVariable("name"))
  289. console.log(_data)
  290. this.tableData = JSON.parse(_data)
  291. // 构造显示数据
  292. this.waterMin = this.tableData[0].waterMin
  293. this.waterMax = this.tableData[0].waterMax
  294. document.title = this.name + '价格对照表(按水分)'
  295. for (let i = 0; i < this.tableData.length; i++) {
  296. // if(!this.tableData[i].waterMin.toString().split(".")[1]){
  297. // this.tableData[i].waterMin = this.tableData[i].waterMin+'.0'
  298. // }
  299. if (i <= 39) {
  300. this.tableData1.push(this.tableData[i])
  301. } else if (i <= 79 && i > 39) {
  302. this.tableData2.push(this.tableData[i])
  303. } else if (i <= 119 && i > 79) {
  304. this.tableData3.push(this.tableData[i])
  305. } else if (i <= 159 && i > 119) {
  306. this.tableData4.push(this.tableData[i])
  307. } else if (i <= 199 && i > 159) {
  308. this.tableData5.push(this.tableData[i])
  309. } else if (i <= 239 && i > 199) {
  310. this.tableData6.push(this.tableData[i])
  311. } else if (i <= 279 && i > 239) {
  312. this.tableData7.push(this.tableData[i])
  313. }
  314. }
  315. // window.print()
  316. window.onafterprint = function(event) {
  317. window.history.back(-1)
  318. };
  319. },
  320. watch: {}
  321. })
  322. </script>
  323. </html>