chnangguirukudan.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <div class="bg">
  3. <!-- 物料验收记录表 - 列表页面打印入库单 -->
  4. <el-dialog
  5. width="900px"
  6. height="279mm"
  7. :modal-append-to-body="false"
  8. title="采购入库单"
  9. :visible.sync="scanVisible"
  10. >
  11. <!-- 表单是否显示 -->
  12. <div style="height: 500px; width: 86%; margin: 0 auto">
  13. <div ref="qrcode" id="box">
  14. <vue-easy-print tableShow ref="easyPrint" :onePageRow="onePageRow">
  15. <div
  16. v-for="(item1, index1) in list"
  17. :key="index1"
  18. style="margin-bottom: 30px;width: 88%;margin: 0px 0px 0px 2px;"
  19. >
  20. <div style="page-break-after: always">
  21. <div style="margin: 0px 0px 0px 2px;">
  22. <table :border="1">
  23. <thead >
  24. <tr class="title">
  25. <th colspan="15" style="line-height: 12px !important;">
  26. <h1 style="display:block;margin:0px;line-height: 16px;font-size:16px;padding: 0px 0px 5px;">采购入库单</h1>
  27. </th>
  28. </tr>
  29. <tr class="title-sub" style="line-height: 12px;">
  30. <th colspan="15" style="padding-top: 2px;padding-bottom: 4px;">
  31. <span style="float: left;">供应商: {{item1.gong_ying_shang_| gongyingshang(gongyingshangList)}}</span>
  32. <span style="margin-left: 6px;float: left;">申购部门: {{item1.shen_gou_bu_men_|bumenfilters(bumenList)}}</span>
  33. <span style="margin-left: 6px;float: right;">日期:{{item1.dao_huo_ri_qi_}}</span>
  34. <span style="margin-left: 6px;float: right;">采购单号:{{item1.cai_gou_ding_dan_}} </span>
  35. </th>
  36. </tr>
  37. <tr style="border:1px solid #000;">
  38. <th style="width: 40px; line-height: 22px">序号</th>
  39. <th >物料编码</th>
  40. <th style="width: 150px;word-wrap: normal !important;word-break: break-all !important;">物料名称</th>
  41. <th >货号</th>
  42. <th >批号</th>
  43. <th >规格/特征</th>
  44. <th >生产商/品牌</th>
  45. <th >数量</th>
  46. <th >单位</th>
  47. <th >单价(含税)</th>
  48. <th >税率</th>
  49. <th >单价</th>
  50. <th >税额</th>
  51. <th >金额</th>
  52. <th >含税合计</th>
  53. </tr>
  54. </thead>
  55. <tbody>
  56. <tr v-for="(item, index) in item1" :key="index" style="border:1px solid #000;">
  57. <td style="width: 20px;word-wrap: normal !important;word-break: break-all !important;">{{ index + 1 }}</td>
  58. <td style="width: 70px;word-wrap: normal !important;word-break: break-all !important;">{{ item.wu_liao_bian_ma_ }}</td>
  59. <td style="width: 150px;word-wrap: normal !important;word-break: break-all !important;">{{ item.wu_liao_ming_chen }}</td>
  60. <td style="width: 60px;word-wrap: normal !important;word-break: break-all !important;">{{ item.huo_hao_ }}</td>
  61. <td style="width: 60px;word-wrap: normal !important;word-break: break-all !important;">{{ item.pi_hao_ }}</td>
  62. <td style="width: 80px;word-wrap: normal !important;word-break: break-all !important;">{{ item.gui_ge_xing_hao_ }}</td>
  63. <td style="width: 100px;word-wrap: normal !important;word-break: break-all !important;"> {{ item.gong_ying_shang_| gongyingshang(gongyingshangList) }} </td>
  64. <td style="width: 45px;word-wrap: normal !important;word-break: break-all !important;">{{ item.shu_liang_ }}</td>
  65. <td style="width: 45px;word-wrap: normal !important;word-break: break-all !important;">{{ item.dan_wei_ }}</td>
  66. <!-- <td style="width: 60px;padding: 1px;word-wrap: normal !important;word-break: break-all !important;">{{ item.dan_jia_han_shui_ |numToFixed}}</td> -->
  67. <td style="width: 60px;padding: 1px;word-wrap: normal !important;word-break: break-all !important;">{{ item.dan_jia_han_shui_}}</td>
  68. <td style="width: 45px;word-wrap: normal !important;word-break: break-all !important;">{{ item.shui_lv_ }}</td>
  69. <!-- <td style="width: 45px;padding: 1px;word-wrap: normal !important;word-break: break-all !important;">{{ item.dan_jia_|numToFixed}}</td> -->
  70. <td style="width: 45px;padding: 1px;word-wrap: normal !important;word-break: break-all !important;">{{ item.shui_lv_==='0%'?item.dan_jia_han_shui_:item.dan_jia_}}</td>
  71. <td style="width: 45px;padding: 1px;word-wrap: normal !important;word-break: break-all !important;"> {{ item.dan_jia_han_shui_|shuieToFixed(item.shu_liang_,item.dan_jia_,item.shui_lv_) }}</td>
  72. <td style="width: 45px;padding: 1px;word-wrap: normal !important;word-break: break-all !important;">{{ item.shui_lv_==='0%'?item.dan_jia_han_shui_:item.dan_jia_|jineToFixed(item.shu_liang_)}}</td>
  73. <td style="width: 60px;word-wrap: normal !important;word-break: break-all !important;">{{ item.dan_jia_han_shui_|jineToFixed(item.shu_liang_) }}</td>
  74. </tr>
  75. <tr class="count" style="border:1px solid #000;">
  76. <td colspan="15">
  77. 合计&nbsp;&nbsp;&nbsp;&nbsp;
  78. 税额:&nbsp;{{ item1|addshuieToFixed}}&nbsp;&nbsp;
  79. 金额:&nbsp;{{ item1|addjineToFixed}}&nbsp;&nbsp;
  80. 含税合计:&nbsp;{{ item1|addhshjToFixed }}
  81. </td>
  82. </tr>
  83. </tbody>
  84. <tfoot class="bottom">
  85. <tr>
  86. <td colspan="5" style="text-align:left">
  87. <div style="float: left;margin-top:5px">仓管员:{{ item1.name2 }}</div>
  88. </td>
  89. <td colspan="10" style="text-align:right">
  90. <div style="margin-top:5px;">审核人:{{ item1.name3 }} </div>
  91. </td>
  92. </tr>
  93. </tfoot>
  94. </table>
  95. </div>
  96. </div>
  97. </div>
  98. </vue-easy-print>
  99. </div>
  100. </div>
  101. <span slot="footer" class="dialog-footer">
  102. <el-button type="primary" @click="printDemo">打印</el-button>
  103. </span>
  104. </el-dialog>
  105. </div>
  106. </template>
  107. <script>
  108. import VueBarcode from "vue-barcode";
  109. import vueEasyPrint from "vue-easy-print";
  110. import repostCurd from "@/business/platform/form/utils/custom/joinCURD.js";
  111. export default {
  112. components: {
  113. VueBarcode,
  114. vueEasyPrint,
  115. },
  116. props: {
  117. obj: {
  118. default: [],
  119. type: Array,
  120. },
  121. onePageRow: {
  122. type: Number,
  123. default: 3,
  124. },
  125. blankLines: {
  126. type: Boolean,
  127. default: true,
  128. },
  129. scanVisible: {
  130. type: Boolean,
  131. default: false,
  132. },
  133. currentScan: {
  134. type: Boolean,
  135. default: false,
  136. },
  137. },
  138. data() {
  139. return {
  140. // onePageRow: 1,
  141. value: "",
  142. id: "",
  143. list: [],
  144. visible: true,
  145. gongyingshangList: [],
  146. bumenList: [],
  147. };
  148. },
  149. created() {
  150. this.getInit();
  151. let sql = `select * FROM t_gysml`;
  152. repostCurd("sql", sql).then((res) => {
  153. this.gongyingshangList = res.variables.data;
  154. });
  155. let sql1 = `select ID_,NAME_ FROM ibps_party_org `;
  156. repostCurd("sql", sql1).then((res) => {
  157. return (this.bumenList = res.variables.data);
  158. });
  159. },
  160. filters: {
  161. gongyingshang: function (value, list) {
  162. for (let i = 0; i < list.length; i++) {
  163. if (value == list[i].id_) {
  164. return list[i].gong_ying_shang_m;
  165. } else if (i == list.length - 1) {
  166. return value;
  167. }
  168. }
  169. },
  170. numToFixed: function (value) {
  171. return (value*1).toFixed(2)
  172. },
  173. jineToFixed:function(a,b){
  174. let value = (a * 1) * (b * 1);
  175. return value.toFixed(2)
  176. },
  177. shuieToFixed:function(a,b,c,d){
  178. console.log(d)
  179. let jine = b*1*(c*1);
  180. let hshj = b*1*(a*1);
  181. let value = hshj - jine;
  182. return d==='0%' ? '0':value.toFixed(2);
  183. },
  184. addshuieToFixed:function(arr){
  185. let adds =0;
  186. arr.forEach(item=>{
  187. adds =adds+(((item.shu_liang_*1) * (item.dan_jia_han_shui_*1)) - ((item.shu_liang_*1) * ((item.shui_lv_==='0%'?item.dan_jia_han_shui_:item.dan_jia_)*1)) );
  188. })
  189. return adds.toFixed(2);
  190. },
  191. addjineToFixed(arr){
  192. let adds =0;
  193. arr.forEach(item=>{
  194. adds =adds+((item.shu_liang_*1) * ((item.shui_lv_==='0%'?item.dan_jia_han_shui_:item.dan_jia_)*1));
  195. })
  196. return adds.toFixed(2);
  197. },
  198. addhshjToFixed(arr){
  199. let adds =0;
  200. arr.forEach(item=>{
  201. adds =adds+((item.shu_liang_*1) * (item.dan_jia_han_shui_*1));
  202. })
  203. return adds.toFixed(2);
  204. },
  205. bumenfilters: function (value, list) {
  206. //
  207. for (let i = 0; i < list.length; i++) {
  208. if (value == list[i].ID_) {
  209. return list[i].NAME_;
  210. } else if (i == list.length - 1) {
  211. return value;
  212. }
  213. }
  214. },
  215. },
  216. watch: {
  217. obj() {
  218. this.getInit();
  219. },
  220. },
  221. methods: {
  222. printDemo() {
  223. this.$refs.easyPrint.print();
  224. // this.$refs.easyPrint.window.print()
  225. },
  226. toDecimal2(x) {
  227. var f = parseFloat(x);
  228. if (isNaN(f)) {
  229. return false;
  230. }
  231. var f = Math.round(x * 100) / 100;
  232. var s = f.toString();
  233. var rs = s.indexOf(".");
  234. if (rs < 0) {
  235. rs = s.length;
  236. s += ".";
  237. }
  238. while (s.length <= rs + 2) {
  239. s += "0";
  240. }
  241. return s;
  242. },
  243. addNumber(num1, num2) {
  244. let a = parseFloat(num1);
  245. let b = parseFloat(num2);
  246. return a.toFixed("2") * 1 + b.toFixed("2") * 1;
  247. },
  248. getInit() {
  249. var idStr = "";
  250. this.obj.forEach((item) => {idStr += item + ",";});
  251. idStr = idStr.substring(0, idStr.length - 1);
  252. this.getLook(idStr);
  253. },
  254. getLook(id) {
  255. this.list = [];
  256. let this_ = this;
  257. let sql = `select * FROM t_yszb WHERE FIND_IN_SET(id_,'${id}')`;
  258. let zhubiao = [];
  259. let name1, name2, name3;
  260. let time1, time2, time3;
  261. let addhanshuiheji = 0;
  262. let addjine = 0;
  263. let addshuie = 0;
  264. repostCurd("sql", sql).then((res) => {
  265. zhubiao = res.variables.data;
  266. zhubiao.forEach((item) => {
  267. let sql1 = `select * FROM t_cgysjlb WHERE FIND_IN_SET(wai_jian_,'${item.id_}') and shu_liang_ != '0'`;
  268. repostCurd("sql", sql1).then((res) => {
  269. let data = res.variables.data;
  270. let s2 = `select a.NAME_,DATE_FORMAT(b.CREATE_TIME_,'%Y-%m-%d') AS CREATE_TIME_ FROM ibps_party_employee as a join ibps_bpm_oper_log as b on a.ID_ = b.CREATE_BY_ where b.PROC_INST_ID_ = ( SELECT PROC_INST_ID_ FROM ibps_bpm_bus_rel WHERE BUSINESSKEY_ = '${item.id_}' LIMIT 1) AND b.NODE_ID_ = 'Activity_04lhxla' ORDER BY b.CREATE_TIME_ DESC LIMIT 1`;
  271. repostCurd("sql", s2).then((res) => {
  272. name2 = res.variables.data[0].NAME_;
  273. time2 = res.variables.data[0].CREATE_TIME_;
  274. data["name2"] = name2;
  275. data["time2"] = time2;
  276. let s3 = `select a.NAME_,DATE_FORMAT(b.CREATE_TIME_,'%Y-%m-%d') AS CREATE_TIME_ FROM ibps_party_employee as a join ibps_bpm_oper_log as b on a.ID_ = b.CREATE_BY_ where b.PROC_INST_ID_ = ( SELECT PROC_INST_ID_ FROM ibps_bpm_bus_rel WHERE BUSINESSKEY_ = '${item.id_}' LIMIT 1) AND b.NODE_ID_ = 'Activity_1dk76gy' ORDER BY b.CREATE_TIME_ DESC LIMIT 1`;
  277. repostCurd("sql", s3).then((res) => {
  278. name3 = res.variables.data[0].NAME_;
  279. time3 = res.variables.data[0].CREATE_TIME_;
  280. data["name3"] = name3;
  281. data["time3"] = time3;
  282. data["gong_ying_shang_"] = item.gong_ying_shang_;
  283. data["shen_gou_bu_men_"] = item.shen_gou_bu_men_;
  284. data["cai_gou_ding_dan_"] = item.cai_gou_ding_dan_;
  285. data["dao_huo_ri_qi_"] = item.dao_huo_ri_qi_;
  286. data.forEach((it) => {
  287. data["addhanshuiheji"] = this.addNumber(
  288. addhanshuiheji,
  289. it.han_shui_he_ji_
  290. );
  291. data["addjine"] = this.addNumber(addjine, it.jin_e_);
  292. data["addshuie"] = this.addNumber(addshuie, it.shui_e_);
  293. addhanshuiheji = data["addhanshuiheji"];
  294. addjine = data["addjine"];
  295. addshuie = data["addshuie"];
  296. });
  297. data["addhanshuiheji"] = this_.toDecimal2(
  298. data["addhanshuiheji"]
  299. );
  300. data["addjine"] = this_.toDecimal2(data["addjine"]);
  301. data["addshuie"] = this_.toDecimal2(data["addshuie"]);
  302. this_.list.push(data);
  303. addhanshuiheji = 0;
  304. addjine = 0;
  305. addshuie = 0;
  306. });
  307. });
  308. });
  309. });
  310. });
  311. },
  312. },
  313. };
  314. </script>
  315. <style lang="scss" scoped>
  316. * {
  317. margin: 0;
  318. padding: 0;
  319. }
  320. table {
  321. border-collapse: collapse;
  322. font-family: "微软雅黑";
  323. background: #fff;
  324. font-size: 12px;
  325. }
  326. .title{
  327. border: 1px solid #fff;
  328. }
  329. .title-sub{
  330. font-size: 12px;
  331. border-left: 1px solid #fff;
  332. border-right: 1px solid #fff;
  333. }
  334. span{
  335. font-weight: 500;
  336. }
  337. td {
  338. text-align: center;
  339. padding: 2px;
  340. }
  341. thead > tr > th {
  342. text-align: center;
  343. font-weight: 500;
  344. }
  345. .el-dialog__body {
  346. word-break: none;
  347. }
  348. .count td {
  349. text-align: right;
  350. padding: 4px 0px;
  351. padding-right: 15px;
  352. }
  353. .bottom {
  354. margin-top: 15px;
  355. }
  356. .bottom {
  357. margin-top: 15px;
  358. border-bottom: 1px solid #fff;
  359. border-left: 1px solid #fff;
  360. border-right: 1px solid #fff;
  361. }
  362. </style>