chnangguirukudan.vue 14 KB

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