print.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <link rel="stylesheet" href="../cdn/element-ui/2.13.2/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" v-cloak>
  132. <div class="content" v-if="type == 1"><!--容重打印-->
  133. <div class="title">
  134. <div class="name">{{name}}{{name != '大豆'? '价格对照表(按容重)' : '价格对照表(按蛋白)'}}</div>
  135. <div class="price">价格单位:元/公斤</div>
  136. </div>
  137. <div class="table-row" v-show="name != '大豆'">
  138. <el-table :data="tableData" :row-class-name="tableRowClassName" >
  139. <el-table-column prop="bulkDensityMax" label="容重上限" header-align="center">
  140. </el-table-column>
  141. <el-table-column prop="bulkDensityMin" label="容重下限" header-align="center">
  142. </el-table-column>
  143. <el-table-column prop="bulkDensityPrice" label="容重单价" header-align="center">
  144. </el-table-column>
  145. </el-table>
  146. </div>
  147. <div class="table-row" v-show="name == '大豆'">
  148. <el-table :data="tableData" :row-class-name="tableRowClassName" >
  149. <el-table-column prop="bulkDensityMax" label="蛋白上限" header-align="center">
  150. </el-table-column>
  151. <el-table-column prop="bulkDensityMin" label="蛋白下限" header-align="center">
  152. </el-table-column>
  153. <el-table-column prop="bulkDensityPrice" label="蛋白单价" header-align="center">
  154. </el-table-column>
  155. </el-table>
  156. </div>
  157. </div>
  158. <div v-else>
  159. <div class="content" :class="'content'+index" v-for="(item,index) in 4" >
  160. <div class="title">
  161. <div class="name" v-if="index==0">一等单价 {{name}}价格对照表(按水分)</div>
  162. <div class="name" v-if="index==1">二等单价 {{name}}价格对照表(按水分)</div>
  163. <div class="name" v-if="index==2">三等单价 {{name}}价格对照表(按水分)</div>
  164. <div class="name" v-if="index==3">等外单价 {{name}}价格对照表(按水分)</div>
  165. <div class="price">价格单位:元/公斤</div>
  166. </div>
  167. <div class="table-row">
  168. <el-table :data="tableData1" :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="tableData2" :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="tableData3" :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="tableData4" :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="tableData5" :row-class-name="tableRowClassName" class="tableBox">
  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. <el-table :data="tableData6" :row-class-name="tableRowClassName" class="tableBox">
  239. <el-table-column prop="waterMin" label="水分" header-align="center">
  240. </el-table-column>
  241. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  242. </el-table-column> -->
  243. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  244. </el-table-column>
  245. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  246. </el-table-column>
  247. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  248. </el-table-column>
  249. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  250. </el-table-column>
  251. </el-table>
  252. <el-table :data="tableData7" :row-class-name="tableRowClassName" class="tableBox tableBox7">
  253. <el-table-column prop="waterMin" label="水分" header-align="center">
  254. </el-table-column>
  255. <!-- <el-table-column prop="waterMax" label="水分上限(%)" header-align="center">
  256. </el-table-column> -->
  257. <el-table-column prop="price1" label="单价" v-if="index==0" header-align="center">
  258. </el-table-column>
  259. <el-table-column prop="price2" label="单价" v-if="index==1" header-align="center">
  260. </el-table-column>
  261. <el-table-column prop="price3" label="单价" v-if="index==2" header-align="center">
  262. </el-table-column>
  263. <el-table-column prop="priceOther" label="单价" v-if="index==3" header-align="center">
  264. </el-table-column>
  265. </el-table>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. </body>
  271. <script src="../cdn/vue/2.6.10/vue.min.js"></script>
  272. <script src="../cdn/element-ui/2.13.2/index.js"></script>
  273. <script type="text/javascript">
  274. new Vue({
  275. el: '#app',
  276. data: {
  277. tableData: [],
  278. tableData1: [],
  279. tableData2: [],
  280. tableData3: [],
  281. tableData4: [],
  282. tableData5: [],
  283. tableData6: [],
  284. tableData7: [],
  285. name: "",
  286. waterMin: '',
  287. waterMax: '',
  288. type:""//1为容重打印
  289. },
  290. computed: {},
  291. methods: {
  292. tableRowClassName({
  293. row,
  294. rowIndex
  295. }) {
  296. if (rowIndex === 1) {
  297. return 'warning-row';
  298. } else if (rowIndex === 3) {
  299. return 'success-row';
  300. }
  301. return '';
  302. },
  303. getQueryVariable(variable) {
  304. var query = window.location.search.substring(1);
  305. var vars = query.split("&");
  306. for (var i = 0; i < vars.length; i++) {
  307. var pair = vars[i].split("=");
  308. if (pair[0] == variable) {
  309. return pair[1];
  310. }
  311. }
  312. return (false);
  313. }
  314. },
  315. mounted() {
  316. let _data = localStorage.getItem("pricePrintList")
  317. this.name = decodeURIComponent(this.getQueryVariable("name"))
  318. this.type = decodeURIComponent(this.getQueryVariable("type"))
  319. console.log(this.type)
  320. console.log(_data)
  321. this.$forceUpdate()
  322. this.tableData = JSON.parse(_data)
  323. // 构造显示数据
  324. this.waterMin = this.tableData[0].waterMin
  325. this.waterMax = this.tableData[0].waterMax
  326. document.title = this.name + '价格对照表(按水分)'
  327. for (let i = 0; i < this.tableData.length; i++) {
  328. // if(!this.tableData[i].waterMin.toString().split(".")[1]){
  329. // this.tableData[i].waterMin = this.tableData[i].waterMin+'.0'
  330. // }
  331. if (i <= 39) {
  332. this.tableData1.push(this.tableData[i])
  333. } else if (i <= 79 && i > 39) {
  334. this.tableData2.push(this.tableData[i])
  335. } else if (i <= 119 && i > 79) {
  336. this.tableData3.push(this.tableData[i])
  337. } else if (i <= 159 && i > 119) {
  338. this.tableData4.push(this.tableData[i])
  339. } else if (i <= 199 && i > 159) {
  340. this.tableData5.push(this.tableData[i])
  341. } else if (i <= 239 && i > 199) {
  342. this.tableData6.push(this.tableData[i])
  343. } else if (i <= 279 && i > 239) {
  344. this.tableData7.push(this.tableData[i])
  345. }
  346. }
  347. // window.print()
  348. window.onafterprint = function(event) {
  349. window.history.back(-1)
  350. };
  351. },
  352. watch: {}
  353. })
  354. </script>
  355. </html>