fundsPDF.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <div>
  3. <div id="pdfDom" style="font-family: 'msyh';">
  4. <div style="padding: 60px 30px; font-size: 12px !important; color: black">
  5. <div style="font-size: 16px; text-align: center; padding: 8px">
  6. <span>{{ dictValueLabel(printDetails.type, fundsType) }}审批单</span>
  7. </div>
  8. <div style="padding: 8px 0">
  9. <span>{{ printDetails.corporationName }}</span>
  10. <span style="padding-left: 32px">创建时间: {{ printDetails.createTime }}</span>
  11. </div>
  12. <div style="border: 1px solid black">
  13. <div style="display: flex; border-bottom: 1px solid black">
  14. <div style="width: 80px; border-right: 1px solid black; padding: 8px">创建人</div>
  15. <div style="flex: 1; padding: 8px">
  16. {{ dictValueLabel(printDetails.createUser, userList) }}
  17. </div>
  18. </div>
  19. <div style="display: flex; border-bottom: 1px solid black">
  20. <div style="width: 80px; border-right: 1px solid black; padding: 8px">创建人部门</div>
  21. <div style="flex: 1; padding: 8px">
  22. {{ printDetails.deptName }}
  23. </div>
  24. </div>
  25. <div style="display: flex; border-bottom: 1px solid black" v-if="printDetails.type !== '3'">
  26. <div style="width: 80px; border-right: 1px solid black; padding: 4px 8px; display: flex; align-items: center">费用明细</div>
  27. <div style="flex: 1">
  28. <div style="border-bottom: 1px solid black; display: flex">
  29. <div style="width: 65px; padding: 4px 8px; border-right: 1px solid black; text-align: center">费用类型</div>
  30. <div style="width: 65px; padding: 4px 8px; border-right: 1px solid black; text-align: center">关联合同</div>
  31. <div style="width: calc(100% - 270px); padding: 4px 8px; border-right: 1px solid black; text-align: center">款项说明</div>
  32. <div style="width: 65px; padding: 4px 8px; border-right: 1px solid black; text-align: center">货币</div>
  33. <div style="width: 75px; padding: 4px 8px; text-align: center">付款金额</div>
  34. </div>
  35. <template v-if="printDetails.accountRequestFundsDetailList && printDetails.accountRequestFundsDetailList.length > 0">
  36. <div v-for="(item, index) in printDetails.accountRequestFundsDetailList" :key="index">
  37. <div
  38. :style="
  39. index + 1 !== printDetails.accountRequestFundsDetailList.length ? 'border-bottom: 1px solid black; display: flex' : ' display: flex'
  40. ">
  41. <div style="width: 65px; padding: 4px 8px; border-right: 1px solid black; text-align: center">
  42. {{ dictValueLabel(item.costType, fundsCostType) }}
  43. </div>
  44. <div style="width: 65px; padding: 4px 8px; border-right: 1px solid black; display: flex; align-items: center">
  45. {{ item.contractCode }}
  46. </div>
  47. <div style="width: calc(100% - 270px); padding: 4px 8px; border-right: 1px solid black; display: flex; align-items: center">
  48. {{ item.remarks }}
  49. </div>
  50. <div style="width: 65px; padding: 4px 8px; border-right: 1px solid black; display: flex; align-items: center">
  51. {{ dictValueLabel(printDetails.currency, accountCurrency) }}
  52. </div>
  53. <div style="width: 75px; padding: 4px 8px; display: flex; align-items: center">
  54. {{ item.amount }}
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. </div>
  60. </div>
  61. <div style="display: flex; border-bottom: 1px solid black" v-else>
  62. <div style="width: 80px; border-right: 1px solid black; padding: 4px 8px; display: flex; align-items: center">费用明细</div>
  63. <div style="flex: 1">
  64. <div style="border-bottom: 1px solid black; display: flex">
  65. <div style="width: 80px; padding: 4px 8px; border-right: 1px solid black; text-align: center">费用类型</div>
  66. <div style="width: 120px; padding: 4px 8px; border-right: 1px solid black; text-align: center">关联合同</div>
  67. <div style="width: calc(100% - 420px); padding: 4px 8px; border-right: 1px solid black; text-align: center">款项说明</div>
  68. <div style="width: 60px; padding: 4px 8px; border-right: 1px solid black; text-align: center">货币</div>
  69. <div style="width: 80px; padding: 4px 8px; border-right: 1px solid black; text-align: center">预支金额</div>
  70. <div style="width: 80px; padding: 4px 8px; text-align: center">付款金额</div>
  71. </div>
  72. <template v-if="printDetails.accountRequestFundsDetailList && printDetails.accountRequestFundsDetailList.length > 0">
  73. <div v-for="(item, index) in printDetails.accountRequestFundsDetailList" :key="index">
  74. <div
  75. :style="
  76. index + 1 !== printDetails.accountRequestFundsDetailList.length ? 'border-bottom: 1px solid black; display: flex' : ' display: flex'
  77. ">
  78. <div style="width: 80px; padding: 4px 8px; border-right: 1px solid black; text-align: center">
  79. {{ dictValueLabel(item.costType, fundsCostType) }}
  80. </div>
  81. <div style="width: 120px; padding: 4px 8px; border-right: 1px solid black; display: flex; align-items: center">
  82. {{ item.contractCode }}
  83. </div>
  84. <div style="width: calc(100% - 420px); padding: 4px 8px; border-right: 1px solid black; display: flex; align-items: center">
  85. {{ item.remarks }}
  86. </div>
  87. <div style="width: 60px; padding: 4px 8px; border-right: 1px solid black; display: flex; align-items: center">
  88. {{ dictValueLabel(printDetails.currency, accountCurrency) }}
  89. </div>
  90. <div style="width: 80px; padding: 4px 8px; border-right: 1px solid black; display: flex; align-items: center">
  91. {{ item.advanceAmount }}
  92. </div>
  93. <div style="width: 80px; padding: 4px 8px; display: flex; align-items: center">
  94. {{ item.amount }}
  95. </div>
  96. </div>
  97. </div>
  98. </template>
  99. </div>
  100. </div>
  101. <div style="display: flex; border-bottom: 1px solid black" v-if="printDetails.type !== '3'">
  102. <div style="width: 80px; border-right: 1px solid black; padding: 8px">总报销金额</div>
  103. <div style="flex: 1; display: flex">
  104. <div style="width: calc(100% - 100px); padding: 8px; border-right: 1px solid black">
  105. {{ NumberToChinese(computeMoney("amount")) }}
  106. </div>
  107. <div style="width: 100px; padding: 8px">
  108. {{ computeMoney("amount") }}
  109. </div>
  110. </div>
  111. </div>
  112. <div v-else>
  113. <div style="display: flex; border-bottom: 1px solid black">
  114. <div style="width: 80px; border-right: 1px solid black; padding: 8px">核销总金额</div>
  115. <div style="flex: 1; display: flex">
  116. <div style="width: calc(100% - 80px); padding: 8px; border-right: 1px solid black">
  117. {{ NumberToChinese(computeMoney("amount")) }}
  118. </div>
  119. <div style="width: 80px; padding: 8px">
  120. {{ computeMoney("amount") }}
  121. </div>
  122. </div>
  123. </div>
  124. <div style="display: flex; border-bottom: 1px solid black">
  125. <div style="width: 80px; border-right: 1px solid black; padding: 8px">预支总金额</div>
  126. <div style="flex: 1; display: flex">
  127. <div style="width: calc(100% - 80px); padding: 8px; border-right: 1px solid black">
  128. {{ NumberToChinese(computeMoney("advanceAmount")) }}
  129. </div>
  130. <div style="width: 80px; padding: 8px">
  131. {{ computeMoney("advanceAmount") }}
  132. </div>
  133. </div>
  134. </div>
  135. <div style="display: flex; border-bottom: 1px solid black">
  136. <div style="width: 80px; border-right: 1px solid black; padding: 8px">差额 (核销 - 预支)</div>
  137. <div style="flex: 1; display: flex">
  138. <div style="width: calc(100% - 80px); padding: 8px; border-right: 1px solid black">
  139. {{ NumberToChinese(computeBalance()) }}
  140. </div>
  141. <div style="width: 80px; padding: 8px">
  142. {{ computeBalance() }}
  143. </div>
  144. </div>
  145. </div>
  146. </div>
  147. <div style="display: flex; border-bottom: 1px solid black">
  148. <div style="width: 80px; border-right: 1px solid black; padding: 8px">单据数量</div>
  149. <div style="flex: 1; padding: 8px">
  150. {{ printDetails.quantity }}
  151. </div>
  152. </div>
  153. <div style="display: flex; border-bottom: 1px solid black">
  154. <div style="width: 80px; border-right: 1px solid black; padding: 0 8px; display: flex; align-items: center">收款信息</div>
  155. <div style="flex: 1">
  156. <div style="border-bottom: 1px solid black; display: flex">
  157. <div style="width: 19%; padding: 0 8px; border-right: 1px solid black; text-align: center">支付方式</div>
  158. <div style="width: 27%; padding: 0 8px; border-right: 1px solid black; text-align: center">收款方户名</div>
  159. <div style="width: 27%; padding: 0 8px; border-right: 1px solid black; text-align: center">开户行</div>
  160. <div style="width: 27%; padding: 0 8px; text-align: center">收款方账号</div>
  161. </div>
  162. <div style="display: flex">
  163. <div style="width: 19%; padding: 0 8px; border-right: 1px solid black; display: flex; align-items: center">
  164. {{ dictValueLabel(printDetails.paymentMethod, fundsPaymentMethod) }}
  165. </div>
  166. <div style="width: 27%; padding: 0 8px; border-right: 1px solid black; display: flex; align-items: center">
  167. {{ printDetails.name }}
  168. </div>
  169. <div style="width: 27%; padding: 0 8px; border-right: 1px solid black; display: flex; align-items: center">
  170. {{ printDetails.openingBank }}
  171. </div>
  172. <div style="width: 27%; padding: 0 8px; display: flex; align-items: center">
  173. {{ printDetails.accountOpening }}
  174. </div>
  175. </div>
  176. </div>
  177. </div>
  178. <div style="display: flex; border-bottom: 1px solid black">
  179. <div style="width: 80px; border-right: 1px solid black; padding: 8px">电子发票(PDF/JPG)</div>
  180. <div style="flex:1; padding: 8px">
  181. {{ printDetails.electronicInvoiceText }}
  182. </div>
  183. </div>
  184. <div style="display: flex">
  185. <div style="width: 80px; border-right: 1px solid black; padding: 4px 8px; display: flex; align-items: center">审批流程</div>
  186. <div style="flex: 1">
  187. <template v-if="printDetails.recordList && printDetails.recordList.length > 0">
  188. <div v-for="(item, index) in printDetails.recordList" :key="index">
  189. <div
  190. :style="
  191. index + 1 !== printDetails.recordList.length
  192. ? 'border-bottom: 1px solid black; padding: 4px 8px; display: flex'
  193. : 'padding: 4px 8px; display: flex'
  194. ">
  195. <div style="width: calc(100% - 120px); word-wrap: break-word">
  196. <span>{{ item.nodeName }}: </span>
  197. <span style="padding-left: 4px">{{ item.processedUser }}</span>
  198. <span style="padding-left: 4px">{{ item.remark }}</span>
  199. </div>
  200. <div style="width: 120px">{{ item.processedDate }}</div>
  201. </div>
  202. </div>
  203. </template>
  204. </div>
  205. </div>
  206. </div>
  207. <div style="padding-top: 16px">
  208. <span>打印时间: {{ presentTime }}</span>
  209. <span style="padding-left: 32px">打印人: {{ useUserStore().user.nickName }}</span>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </template>
  215. <script setup>
  216. import useUserStore from "@/store/modules/user";
  217. import { ref } from "vue";
  218. import { NumberToChinese } from "@/utils/util.js";
  219. import moment from "moment";
  220. const { proxy } = getCurrentInstance();
  221. const fundsType = ref([]);
  222. const userList = ref([]);
  223. const companyData = ref([]);
  224. const accountCurrency = ref([]);
  225. const fundsCostType = ref([]);
  226. const fundsPaymentMethod = ref([]);
  227. const getDictData = () => {
  228. proxy.getDictOne(["founds_type", "funds_payment_method", "account_currency", "funds_cost_type"]).then((res) => {
  229. fundsType.value = res["founds_type"].map((x) => ({
  230. label: x.dictValue,
  231. value: x.dictKey,
  232. }));
  233. fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
  234. label: x.dictValue,
  235. value: x.dictKey,
  236. }));
  237. accountCurrency.value = res["account_currency"].map((x) => ({
  238. label: x.dictValue,
  239. value: x.dictKey,
  240. }));
  241. fundsCostType.value = res["funds_cost_type"].map((x) => ({
  242. label: x.dictValue,
  243. value: x.dictKey,
  244. }));
  245. });
  246. proxy
  247. .get("/tenantUser/list", {
  248. pageNum: 1,
  249. pageSize: 10000,
  250. tenantId: useUserStore().user.tenantId,
  251. })
  252. .then((res) => {
  253. if (res.rows && res.rows.length > 0) {
  254. userList.value = res.rows.map((item) => {
  255. return {
  256. deptId: item.deptId,
  257. label: item.nickName,
  258. value: item.userId,
  259. };
  260. });
  261. }
  262. });
  263. proxy.post("/corporation/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
  264. if (res.rows && res.rows.length > 0) {
  265. companyData.value = res.rows.map((item) => {
  266. return {
  267. label: item.name,
  268. value: item.id,
  269. };
  270. });
  271. }
  272. });
  273. };
  274. getDictData();
  275. const printDetails = ref({});
  276. const presentTime = ref(moment().format("yyyy-MM-DD HH:mm:ss"));
  277. const computeMoney = (label) => {
  278. let amount = 0;
  279. if (printDetails.value.accountRequestFundsDetailList && printDetails.value.accountRequestFundsDetailList.length > 0) {
  280. for (let i = 0; i < printDetails.value.accountRequestFundsDetailList.length; i++) {
  281. if (printDetails.value.accountRequestFundsDetailList[i][label]) {
  282. amount = Number(parseFloat(Number(amount) + Number(printDetails.value.accountRequestFundsDetailList[i][label])).toFixed(2));
  283. }
  284. }
  285. }
  286. return amount;
  287. };
  288. const computeBalance = () => {
  289. let balance = 0;
  290. let advanceAmount = computeMoney("advanceAmount");
  291. let amount = computeMoney("amount");
  292. if (amount) {
  293. balance = Number(amount);
  294. }
  295. if (advanceAmount) {
  296. balance = Number(parseFloat(Number(balance) - Number(advanceAmount)).toFixed(2));
  297. }
  298. return balance;
  299. };
  300. const props = defineProps({
  301. rowData: Object,
  302. });
  303. onMounted(() => {
  304. if (props.rowData && props.rowData.id) {
  305. proxy.post("/accountRequestFunds/detail", { id: props.rowData.id }).then((res) => {
  306. printDetails.value = res;
  307. proxy.post("/fileInfo/getList", { businessIdList: [props.rowData.id] }).then((resFile) => {
  308. let electronicInvoiceText = "";
  309. if (resFile[props.rowData.id] && resFile[props.rowData.id].length > 0) {
  310. for (let i = 0; i < resFile[props.rowData.id].length; i++) {
  311. if (i === 0) {
  312. electronicInvoiceText = resFile[props.rowData.id][0].fileName;
  313. } else {
  314. electronicInvoiceText = electronicInvoiceText + ", " + resFile[props.rowData.id][i].fileName;
  315. }
  316. }
  317. }
  318. printDetails.value.electronicInvoiceText = electronicInvoiceText;
  319. });
  320. if (res.flowInfoId) {
  321. proxy.post("/flowExample/getApprovalRecord", { id: res.flowInfoId }).then((record) => {
  322. printDetails.value.recordList = record.recordList;
  323. });
  324. }
  325. });
  326. }
  327. });
  328. </script>
  329. <style lang="scss" scoped></style>