index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <div class="pageIndexClass">
  3. <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" :selectConfig="selectConfig"
  4. highlight-current-row :action-list="[
  5. {
  6. text: '发起申请',
  7. action: () => purchasePayment(),
  8. },
  9. ]" @get-list="getList">
  10. <template #amount="{ item }">
  11. <div>
  12. <span>{{ moneyFormat(item.amount, 2) }}</span>
  13. </div>
  14. </template>
  15. </byTable>
  16. <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="840px">
  17. <PaymentPDF :rowData="rowData"></PaymentPDF>
  18. <template #footer>
  19. <el-button @click="openPrint = false" size="default">取消</el-button>
  20. <el-button type="primary" v-print="printObj" size="default">打印</el-button>
  21. <el-button type="primary" @click="clickDownload()" size="default">下载PDF</el-button>
  22. </template>
  23. </el-dialog>
  24. </div>
  25. </template>
  26. <script setup>
  27. import { computed, ref } from "vue";
  28. import byTable from "@/components/byTable/index";
  29. import useUserStore from "@/store/modules/user";
  30. import PaymentPDF from "@/components/PDF/paymentPDF.vue";
  31. const { proxy } = getCurrentInstance();
  32. const payStatus = ref([]);
  33. const fundsPaymentMethod = ref([]);
  34. const accountList = ref([]);
  35. const userList = ref([]);
  36. const status = ref([
  37. {
  38. label: "草稿",
  39. value: 0,
  40. },
  41. {
  42. label: "审批中",
  43. value: 10,
  44. },
  45. {
  46. label: "驳回",
  47. value: 20,
  48. },
  49. {
  50. label: "审批通过",
  51. value: 30,
  52. },
  53. {
  54. label: "终止",
  55. value: 99,
  56. },
  57. ]);
  58. const sourceList = ref({
  59. data: [],
  60. pagination: {
  61. total: 0,
  62. pageNum: 1,
  63. pageSize: 10,
  64. keyword: "",
  65. status: "",
  66. payStatus: "",
  67. },
  68. });
  69. const loading = ref(false);
  70. const selectConfig = computed(() => {
  71. return [
  72. {
  73. label: "业务公司",
  74. prop: "companyId",
  75. data: proxy.useUserStore().allDict["list_company_data"],
  76. },
  77. {
  78. label: "审批状态",
  79. prop: "status",
  80. data: status.value,
  81. },
  82. {
  83. label: "付款状态",
  84. prop: "payStatus",
  85. data: payStatus.value,
  86. },
  87. ];
  88. });
  89. const config = computed(() => {
  90. return [
  91. {
  92. attrs: {
  93. label: "业务公司",
  94. prop: "companyName",
  95. width: 110,
  96. },
  97. },
  98. {
  99. attrs: {
  100. label: "供应商",
  101. prop: "supplyName",
  102. width: 200,
  103. },
  104. },
  105. {
  106. attrs: {
  107. label: "申请金额",
  108. slot: "amount",
  109. width: 140,
  110. },
  111. },
  112. {
  113. attrs: {
  114. label: "付款说明",
  115. prop: "remark",
  116. },
  117. },
  118. {
  119. attrs: {
  120. label: "付款方式",
  121. prop: "payType",
  122. width: 160,
  123. },
  124. render(type) {
  125. return proxy.dictValueLabel(type, fundsPaymentMethod.value);
  126. },
  127. },
  128. {
  129. attrs: {
  130. label: "付款账户",
  131. prop: "accountManagementId",
  132. width: 200,
  133. },
  134. render(type) {
  135. return proxy.dictValueLabel(type, accountList.value);
  136. },
  137. },
  138. {
  139. attrs: {
  140. label: "申请人",
  141. prop: "createUser",
  142. width: 140,
  143. },
  144. render(type) {
  145. return proxy.dictValueLabel(type, userList.value);
  146. },
  147. },
  148. {
  149. attrs: {
  150. label: "申请时间",
  151. prop: "createTime",
  152. width: 160,
  153. },
  154. },
  155. {
  156. attrs: {
  157. label: "审批状态",
  158. prop: "status",
  159. width: 140,
  160. },
  161. render(type) {
  162. return proxy.dictValueLabel(type, status.value);
  163. },
  164. },
  165. {
  166. attrs: {
  167. label: "付款状态",
  168. prop: "payStatus",
  169. width: 140,
  170. },
  171. render(type) {
  172. return proxy.dictValueLabel(type, payStatus.value);
  173. },
  174. },
  175. {
  176. attrs: {
  177. label: "操作",
  178. width: "120",
  179. align: "center",
  180. },
  181. renderHTML(row) {
  182. return [
  183. {
  184. attrs: {
  185. label: "打印",
  186. type: "primary",
  187. text: true,
  188. },
  189. el: "button",
  190. click() {
  191. clickPrint(row);
  192. },
  193. },
  194. ];
  195. },
  196. },
  197. ];
  198. });
  199. const getDict = () => {
  200. proxy
  201. .post("/dictTenantData/page", {
  202. pageNum: 1,
  203. pageSize: 999,
  204. dictCode: "pay_status",
  205. tenantId: useUserStore().user.tenantId,
  206. })
  207. .then((res) => {
  208. if (res.rows && res.rows.length > 0) {
  209. payStatus.value = res.rows.map((item) => {
  210. return {
  211. label: item.dictValue,
  212. value: item.dictKey,
  213. };
  214. });
  215. }
  216. });
  217. proxy
  218. .post("/dictTenantData/page", {
  219. pageNum: 1,
  220. pageSize: 999,
  221. dictCode: "funds_payment_method",
  222. tenantId: useUserStore().user.tenantId,
  223. })
  224. .then((res) => {
  225. if (res.rows && res.rows.length > 0) {
  226. fundsPaymentMethod.value = res.rows.map((item) => {
  227. return {
  228. label: item.dictValue,
  229. value: item.dictKey,
  230. };
  231. });
  232. }
  233. });
  234. proxy
  235. .post("/accountManagement/page", { pageNum: 1, pageSize: 999 })
  236. .then((res) => {
  237. accountList.value = res.rows.map((item) => {
  238. return {
  239. label: item.alias,
  240. value: item.id,
  241. };
  242. });
  243. });
  244. proxy
  245. .get("/tenantUser/list", {
  246. pageNum: 1,
  247. pageSize: 10000,
  248. tenantId: useUserStore().user.tenantId,
  249. })
  250. .then((res) => {
  251. if (res.rows && res.rows.length > 0) {
  252. userList.value = res.rows.map((item) => {
  253. return {
  254. deptId: item.deptId,
  255. label: item.nickName,
  256. value: item.userId,
  257. };
  258. });
  259. }
  260. });
  261. };
  262. const getList = async (req) => {
  263. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  264. loading.value = true;
  265. proxy.post("/pay/page", sourceList.value.pagination).then((res) => {
  266. sourceList.value.data = res.rows;
  267. sourceList.value.pagination.total = res.total;
  268. setTimeout(() => {
  269. loading.value = false;
  270. }, 200);
  271. });
  272. };
  273. getDict();
  274. getList();
  275. const purchasePayment = () => {
  276. proxy.$router.replace({
  277. path: "/platform_manage/process/processApproval",
  278. query: {
  279. flowKey: "pay_flow",
  280. flowName: "采购付款申请",
  281. random: proxy.random(),
  282. },
  283. });
  284. };
  285. const openPrint = ref(false);
  286. const rowData = ref({});
  287. const clickPrint = (row) => {
  288. rowData.value = row;
  289. openPrint.value = true;
  290. };
  291. const clickDownload = () => {
  292. proxy.getPdf("采购付款PDF文件");
  293. };
  294. const printObj = ref({
  295. id: "pdfDom",
  296. popTitle: "",
  297. extraCss:
  298. "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css",
  299. extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
  300. });
  301. </script>
  302. <style lang="scss" scoped>
  303. .tenant {
  304. padding: 20px;
  305. }
  306. ::v-deep(.el-input-number .el-input__inner) {
  307. text-align: left;
  308. }
  309. </style>