caigourukudan.vue 15 KB

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