lingliaodan.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <div class="bg">
  3. <el-dialog
  4. width="900px"
  5. height="279mm"
  6. :modal-append-to-body="false"
  7. title="领料单"
  8. :visible.sync="scanVisible"
  9. >
  10. <!-- 表单是否显示 -->
  11. <div style="height: 500px; width: 90%; margin: 0 auto">
  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;width: 89%;margin:0px 0px 0px 0px;"
  18. >
  19. <div style="page-break-after: always">
  20. <div style="margin: 0px 0px 0px 27px;">
  21. <table :border="1">
  22. <thead>
  23. <tr class="title" style="background:#ffffff">
  24. <th colspan="15" style="line-height: 10px !important;font-size: 6px !important;">
  25. <h1 style="display:block;line-height: 10px;font-size: 6px;">领料单</h1>
  26. </th>
  27. </tr>
  28. <tr class="title" style="background:#ffffff;line-height: 9px;">
  29. <th colspan="15">
  30. <span style="float: left;: 1px;">
  31. 领料部门:<span style="margin-left: 10px">{{item1.bu_men_ming_cheng}}</span>
  32. </span>
  33. <span style="float:right;padding-right: 8px;padding: 1px;">领料单号:{{ item1.ling_liao_chu_ku_ }}</span>
  34. <span style="float:right;padding-right: 8px;padding: 1px;width: 165px;">领料日期:{{ item1.ling_liao_ri_qi_}}</span>
  35. </th>
  36. </tr>
  37. <!-- <tr class="title" style="background:#ffffff;line-height: 9px;">
  38. <th colspan="15">
  39. <span style="float:right;padding-right: 8px;">领料单编号:{{ item1.ling_liao_chu_ku_ }}</span>
  40. </th>
  41. </tr> -->
  42. <tr>
  43. <th style="width: 40px; line-height: 22px">序号</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. </tr>
  56. </thead>
  57. <tbody>
  58. <tr v-for="(item, index) in item1" :key="index">
  59. <td style="width: 30px">{{ index + 1 }}</td>
  60. <td style="width: 90px">{{ item.wu_liao_bian_hao_ }}</td>
  61. <td style="width: 100px">{{ item.wu_liao_ming_chen }}
  62. </td>
  63. <!-- <td style="width: 60px">{{ item.huo_hao_ }}</td> -->
  64. <td style="width: 80px">{{ item.pi_hao_ }}</td>
  65. <td style="width: 120px">{{ item.gui_ge_xing_hao_ }}</td>
  66. <td style="width: 60px">{{ item.shu_liang_ }}</td>
  67. <td style="width: 60px">{{ item.dan_wei_ }}</td>
  68. <td style="width: 60px">{{ item.dan_jia_ |numToFixed(item.dan_jia_) }}</td>
  69. <td style="width: 60px">{{ item.dan_jia_|jineToFixed(item.shu_liang_ ) }}</td>
  70. <td style="width: 85px">{{ item.yong_tu_ }}</td>
  71. <td style="width: 85px">{{ item.bei_zhu_ }}</td>
  72. </tr>
  73. <tr>
  74. <td style="width: 30px"></td>
  75. <td style="width: 90px"></td>
  76. <td style="width: 130px"></td>
  77. <td style="width: 80px"></td>
  78. <td style="width: 100px"></td>
  79. <td style="width: 60px"></td>
  80. <td style="width: 60px"></td>
  81. <td style="width: 60px"></td>
  82. <td style="width: 60px"></td>
  83. <td style="width: 85px"></td>
  84. <td style="width: 85px">
  85. 合计:{{ item1.heji }}
  86. </td>
  87. </tr>
  88. </tbody>
  89. <tfoot >
  90. <tr class="bottom">
  91. <td colspan="4" style="text-align:left">
  92. <!-- <div style="float: left;margin-top:10px">领用人/日期:{{ item1.name1 }}/{{ item1.ling_liao_ri_qi_ }}</div> -->
  93. <div style="float: left;margin-top:10px">领用人:{{ item1.name1 }}</div>
  94. </td>
  95. <td colspan="4" class="footer-row">
  96. <!-- <div style="margin: 0 auto;margin-top:10px">审核人/日期 :{{ item1.name2 }} /{{item1.time2}}</div> -->
  97. <div style="margin: 0 auto;margin-top:10px">审核人{{ item1.name2 }}</div>
  98. </td>
  99. <td colspan="5" style="text-align:right">
  100. <!-- <div style="margin-top:10px">发放人/日期 :{{ item1.name3 }}/{{ item1.time3 }}</div> -->
  101. <div style="margin-top:10px">发放人:{{ item1.name3 }}</div>
  102. </td>
  103. </tr>
  104. </tfoot>
  105. </table>
  106. </div>
  107. </div>
  108. </div>
  109. </vue-easy-print>
  110. </div>
  111. </div>
  112. <span slot="footer" class="dialog-footer">
  113. <!-- <el-button @click="dialogVisible = false">取 消</el-button> -->
  114. <el-button type="primary" @click="printDemo">打印</el-button>
  115. </span>
  116. </el-dialog>
  117. </div>
  118. </template>
  119. <script>
  120. import VueBarcode from "vue-barcode";
  121. import vueEasyPrint from "vue-easy-print";
  122. import repostCurd from "@/business/platform/form/utils/custom/joinCURD.js";
  123. import { Loading } from "element-ui";
  124. import { toFixed } from "@/views/platform/form/formPrint/utils";
  125. export default {
  126. components: {
  127. VueBarcode,
  128. vueEasyPrint,
  129. },
  130. props: {
  131. obj: {
  132. default: [],
  133. type: Array,
  134. },
  135. onePageRow: {
  136. type: Number,
  137. default: 3,
  138. },
  139. blankLines: {
  140. type: Boolean,
  141. default: true,
  142. },
  143. scanVisible: {
  144. type: Boolean,
  145. default: false,
  146. },
  147. currentScan: {
  148. type: Boolean,
  149. default: false,
  150. },
  151. },
  152. data() {
  153. return {
  154. // onePageRow: 1,
  155. value: "",
  156. id: "",
  157. list: [],
  158. visible: true,
  159. bumenList:[],
  160. };
  161. },
  162. created() {
  163. this.getInit();
  164. this.bumenListRequest();
  165. },
  166. filters: {
  167. name4: function (value) {
  168. let s3 = `select NAME_,CREATE_TIME_ FROM ibps_party_employee where id_ =( select CREATE_BY_ FROM ibps_bpm_oper_log WHERE PROC_INST_ID_ = ( SELECT PROC_INST_ID_ FROM ibps_bpm_bus_rel WHERE BUSINESSKEY_ = '${value}' LIMIT 1) AND NODE_ID_ = 'Activity_0dbdxg7' ORDER BY CREATE_TIME_ DESC LIMIT 1)`;
  169. repostCurd("sql", s3).then((res) => {
  170. return res.variables.data[0].NAME_;
  171. });
  172. },
  173. numToFixed: function (value) {
  174. return (value*1).toFixed(2)
  175. },
  176. jineToFixed:function(a,b){
  177. let value = (a * 1) * (b * 1)
  178. return value.toFixed(2)
  179. },
  180. bumenfilters: function (value, list) {
  181. for (let i = 0; i < list.length; i++) {
  182. if (value == list[i].ID_) {
  183. return list[i].NAME_;
  184. } else if (i == list.length - 1) {
  185. return value;
  186. }
  187. }
  188. },
  189. },
  190. watch: {
  191. obj() {
  192. this.getInit();
  193. },
  194. },
  195. methods: {
  196. printDemo() {
  197. this.$refs.easyPrint.print();
  198. // this.$refs.easyPrint.window.print()
  199. },
  200. bumenListRequest(){ //部门列表
  201. let sql = "select ID_,NAME_ FROM ibps_party_org ";
  202. let this_ = this;
  203. repostCurd("sql", sql).then((res) => {
  204. this_.bumenList = res.variables.data;
  205. });
  206. },
  207. getInit() {
  208. var idStr = "";
  209. this.obj.forEach((item) => {
  210. idStr += item + ",";
  211. });
  212. idStr = idStr.substring(0, idStr.length - 1);
  213. this.getLook(idStr);
  214. },
  215. addNumber(num1, num2) {
  216. let a = parseFloat(num1);
  217. let b = parseFloat(num2);
  218. return a.toFixed("2") * 1 + b.toFixed("2") * 1;
  219. },
  220. riqi(value) {
  221. let date = new Date(value);
  222. let y = date.getFullYear(); //获取年份
  223. let m = date.getMonth() + 1; //获取月份
  224. m = m < 10 ? "0" + m : m; //月份不满10天显示前加0
  225. let d = date.getDate(); //获取日期
  226. d = d < 10 ? "0" + d : d; //日期不满10天显示前加0
  227. return y + "-" + m + "-" + d;
  228. },
  229. toDecimal2(x) {
  230. var f = parseFloat(x);
  231. if (isNaN(f)) {
  232. return false;
  233. }
  234. var f = Math.round(x * 100) / 100;
  235. var s = f.toString();
  236. var rs = s.indexOf(".");
  237. if (rs < 0) {
  238. rs = s.length;
  239. s += ".";
  240. }
  241. while (s.length <= rs + 2) {
  242. s += "0";
  243. }
  244. return s;
  245. },
  246. getLook(id) {
  247. let this_ = this;
  248. this.list = [];
  249. let sql = `select * FROM t_crkjlb WHERE FIND_IN_SET(id_,'${id}')`;
  250. let zhubiao = [];
  251. let name1, name2, name3;
  252. let time1, time2, time3;
  253. repostCurd("sql", sql).then((res) => {
  254. zhubiao = res.variables.data;
  255. console.log(zhubiao)
  256. zhubiao.forEach((item) => {
  257. let sql1 = `select * FROM t_crkjlx WHERE FIND_IN_SET(parent_id_,'${item.id_}')`;
  258. let chushi = 0;
  259. repostCurd("sql", sql1).then((res) => {
  260. let data = res.variables.data;
  261. if (!name1) {
  262. let s1 = `select NAME_ FROM ibps_party_employee where id_ =( SELECT cao_zuo_ren_ FROM t_crkjlb WHERE id_ = '${item.id_}')`;
  263. repostCurd("sql", s1).then((res) => {
  264. name1 = res.variables.data[0].NAME_;
  265. data["name1"] = name1;
  266. });
  267. }
  268. 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_0t9dfi3' ORDER BY b.CREATE_TIME_ DESC LIMIT 1`;
  269. repostCurd("sql", s2).then((res) => {
  270. name2 = res.variables.data[0].NAME_;
  271. time2 = res.variables.data[0].CREATE_TIME_;
  272. data["name2"] = name2;
  273. data["time2"] = time2;
  274. 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_0dbdxg7' ORDER BY b.CREATE_TIME_ DESC LIMIT 1`;
  275. repostCurd("sql", s3).then((res) => {
  276. if(res.variables.data.length >0){
  277. name3 = res.variables.data[0].NAME_;
  278. time3 = res.variables.data[0].CREATE_TIME_;
  279. }
  280. data["name3"] = name3;
  281. data["time3"] = time3;
  282. data["ling_liao_chu_ku_"] = item.ling_liao_chu_ku_;
  283. data["id_"] = item.id_;
  284. data["bu_men_ming_cheng"] = item.bu_men_ming_cheng;
  285. data["ling_liao_ri_qi_"] = item.ling_liao_ri_qi_;
  286. data["gong_ying_shang_"] = item.gong_ying_shang_ || 0;
  287. data.forEach((it) => {
  288. data["heji"] = this.addNumber(chushi, it.jin_e_);
  289. chushi = data["heji"];
  290. });
  291. data["heji"] = this_.toDecimal2(data["heji"]);
  292. this_.list.push(data);
  293. chushi = 0;
  294. });
  295. });
  296. });
  297. });
  298. });
  299. },
  300. },
  301. };
  302. </script>
  303. <style lang="scss" scoped>
  304. .bottom {
  305. margin-top: 15px;
  306. // display: flex;
  307. // justify-content: space-between;
  308. // align-items: center;
  309. font-size: 12px;
  310. }
  311. .bottom {
  312. margin-top: 15px;
  313. border-bottom: 1px solid #fff;
  314. border-left: 1px solid #fff;
  315. border-right: 1px solid #fff;
  316. }
  317. .title{
  318. border-top: 1px solid #fff;
  319. border-left: 1px solid #fff;
  320. border-right: 1px solid #fff;
  321. }
  322. .word-title {
  323. display: flex;
  324. justify-content: center;
  325. }
  326. thead {
  327. background: #f3f3f3;
  328. }
  329. .el-dialog__body {
  330. color: #0d0e0f;
  331. font-size: 10px !important;
  332. word-break: none;
  333. }
  334. thead > tr > th {
  335. font-size: 10px;
  336. text-align: center;
  337. font-weight: normal;
  338. color: #01060c;
  339. }
  340. thead > tr > th > td {
  341. font-size: 10px;
  342. text-align: center;
  343. font-weight: normal;
  344. color: #01060c;
  345. }
  346. .logo {
  347. position: absolute;
  348. top: -32px;
  349. left: 0;
  350. }
  351. .tagBox {
  352. position: relative;
  353. width: 100%;
  354. // border: 1px solid #000000;
  355. padding: 5px;
  356. display: flex;
  357. display: flex;
  358. justify-content: space-between;
  359. background-color: #fff;
  360. }
  361. .la {
  362. display: flex;
  363. align-items: center;
  364. }
  365. .lh {
  366. // line-height: auto;
  367. font-size: 12px;
  368. display: flex;
  369. align-items: center;
  370. }
  371. * {
  372. margin: 0;
  373. padding: 0;
  374. }
  375. table {
  376. border-collapse: collapse;
  377. text-align: center;
  378. border: 1px solid #01060c;
  379. }
  380. td {
  381. width: 120px;
  382. // height: 50px;
  383. text-align: center;
  384. font-size: 10px;
  385. }
  386. .friday {
  387. width: 100px;
  388. height: 50px;
  389. }
  390. </style>