index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <div class="pageIndexClass">
  3. <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" :selectConfig="selectConfig"
  4. highlight-current-row @get-list="getList">
  5. <template #amount="{ item }">
  6. <div>
  7. <span style="padding-right: 4px">{{ item.currency }}</span>
  8. <span>{{ moneyFormat(item.amount, 2) }}</span>
  9. </div>
  10. </template>
  11. <template #contractCodes="{ item }">
  12. <div>
  13. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickPrint(item)">{{ item.contractCodes }}</a>
  14. </div>
  15. </template>
  16. </byTable>
  17. <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="840px">
  18. <FundsPDF v-if="rowData.type != '20'" :rowData="rowData"></FundsPDF>
  19. <PaymentPDF v-else :rowData="rowData"></PaymentPDF>
  20. <template #footer>
  21. <el-button @click="openPrint = false" size="default">取消</el-button>
  22. <el-button type="primary" @click="clickDownload()" size="default">下载PDF</el-button>
  23. </template>
  24. </el-dialog>
  25. </div>
  26. </template>
  27. <script setup>
  28. import byTable from "@/components/byTable/index";
  29. import FundsPDF from "@/components/PDF/fundsPDF.vue";
  30. import PaymentPDF from "@/components/PDF/paymentPDF.vue";
  31. const { proxy } = getCurrentInstance();
  32. const corporationList = ref([]);
  33. const fundsType = ref([]);
  34. const sourceList = ref({
  35. data: [],
  36. pagination: {
  37. total: 0,
  38. pageNum: 1,
  39. pageSize: 10,
  40. keyword: "",
  41. corporationId: "",
  42. type: "",
  43. },
  44. });
  45. const loading = ref(false);
  46. const selectConfig = computed(() => {
  47. return [
  48. {
  49. label: "归属公司",
  50. prop: "corporationId",
  51. data: corporationList.value,
  52. },
  53. {
  54. label: "数据来源",
  55. prop: "type",
  56. data: fundsType.value,
  57. },
  58. ];
  59. });
  60. const config = computed(() => {
  61. return [
  62. {
  63. attrs: {
  64. label: "归属公司",
  65. prop: "corporationName",
  66. "min-width": 220,
  67. },
  68. },
  69. {
  70. attrs: {
  71. label: "数据来源",
  72. prop: "type",
  73. "min-width": 130,
  74. },
  75. render(type) {
  76. if (type != 20) {
  77. return "请款: " + proxy.dictValueLabel(type, fundsType.value);
  78. } else {
  79. return "采购付款";
  80. }
  81. },
  82. },
  83. {
  84. attrs: {
  85. label: "关联单号",
  86. slot: "contractCodes",
  87. "min-width": 160,
  88. },
  89. },
  90. {
  91. attrs: {
  92. label: "申请时间",
  93. prop: "applicationTime",
  94. "min-width": 160,
  95. },
  96. },
  97. {
  98. attrs: {
  99. label: "申请金额",
  100. slot: "amount",
  101. align: "right",
  102. "min-width": 120,
  103. },
  104. },
  105. {
  106. attrs: {
  107. label: "打款时间",
  108. prop: "accountPaymentDate",
  109. "min-width": 160,
  110. },
  111. },
  112. {
  113. attrs: {
  114. label: "冲销人",
  115. prop: "writeOffUserName",
  116. "min-width": 160,
  117. },
  118. },
  119. {
  120. attrs: {
  121. label: "冲销时间",
  122. prop: "createTime",
  123. "min-width": 160,
  124. },
  125. },
  126. ];
  127. });
  128. const getDict = () => {
  129. proxy.getDictOne(["founds_type"]).then((res) => {
  130. fundsType.value = res["founds_type"]
  131. .map((x) => ({
  132. label: x.dictValue,
  133. value: x.dictKey,
  134. }))
  135. .concat({
  136. label: "采购付款",
  137. value: "20",
  138. });
  139. });
  140. proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  141. if (res.rows && res.rows.length > 0) {
  142. corporationList.value = res.rows.map((item) => {
  143. return {
  144. label: item.name,
  145. value: item.id,
  146. };
  147. });
  148. }
  149. });
  150. };
  151. const getList = async (req) => {
  152. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  153. loading.value = true;
  154. proxy
  155. .post("/writeOffRecords/page", sourceList.value.pagination)
  156. .then((res) => {
  157. sourceList.value.data = res.rows;
  158. sourceList.value.pagination.total = res.total;
  159. setTimeout(() => {
  160. loading.value = false;
  161. }, 200);
  162. });
  163. };
  164. getDict();
  165. getList();
  166. const openPrint = ref(false);
  167. const rowData = ref({});
  168. const clickPrint = (row) => {
  169. rowData.value = {
  170. id: row.businessId,
  171. type: row.type,
  172. };
  173. openPrint.value = true;
  174. };
  175. const clickDownload = () => {
  176. if (rowData.value.type != "20") {
  177. proxy.getPdf("请款PDF文件");
  178. } else {
  179. proxy.getPdf("采购付款PDF文件");
  180. }
  181. };
  182. </script>
  183. <style lang="scss" scoped>
  184. .tenant {
  185. padding: 20px;
  186. }
  187. </style>