contractDetails.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <div>
  3. <el-tabs
  4. v-model="activeName"
  5. class="demo-tabs"
  6. @tab-click="handleClick"
  7. @tab-change="handleChange"
  8. stretch
  9. >
  10. <el-tab-pane label="销售合同" name="first"></el-tab-pane>
  11. <el-tab-pane label="采购合同" name="second"></el-tab-pane>
  12. <el-tab-pane label="交易明细" name="third"></el-tab-pane>
  13. </el-tabs>
  14. <div class="content-box" v-if="activeName !== 'third'">
  15. <div class="left">
  16. <div
  17. v-for="i in leftList"
  18. :key="i.id"
  19. class="left-item"
  20. :style="{ color: currentItem.id === i.id ? '#409eff' : '' }"
  21. @click="handleItemClick(i)"
  22. >
  23. <div v-if="activeName === 'first'">v {{ i.version }}</div>
  24. <div v-if="activeName === 'second'">
  25. {{ i.code }}
  26. </div>
  27. </div>
  28. </div>
  29. <div class="right">
  30. <div v-if="leftList && leftList.length > 0">
  31. <div
  32. style="text-align: right; margin-bottom: 20px"
  33. v-if="activeName === 'first'"
  34. >
  35. <el-button type="primary" @click="pushProcessApproval(currentItem)"
  36. >查看详情</el-button
  37. >
  38. </div>
  39. <div v-if="activeName === 'first'">
  40. <!-- <ContractPDF :rowData="rowData"></ContractPDF> -->
  41. <ContractPDFOne :rowData="rowData"></ContractPDFOne>
  42. </div>
  43. <div v-if="activeName === 'second'">
  44. <PurchasePDF :rowData="rowDataOne"></PurchasePDF>
  45. </div>
  46. </div>
  47. <div v-else style="padding-left: 300px">暂无数据</div>
  48. </div>
  49. </div>
  50. <div v-if="activeName === 'third'">
  51. <byTable
  52. :hidePagination="true"
  53. :hideSearch="true"
  54. :source="tableData"
  55. :config="config"
  56. highlight-current-row
  57. :action-list="[]"
  58. >
  59. <template #amount="{ item }">
  60. <div>{{ item.currency }} {{ moneyFormat(item.amount, 2) }}</div>
  61. </template>
  62. <template #accountManagementName="{ item }">
  63. <div>
  64. {{ item.accountManagementName }} ({{
  65. item.accountManagementOpening
  66. }})
  67. </div>
  68. </template>
  69. </byTable>
  70. </div>
  71. </div>
  72. </template>
  73. <script setup>
  74. import PurchasePDF from "@/components/PDF/purchasePDF.vue";
  75. import ContractPDF from "@/components/PDF/contractPDF.vue";
  76. import ContractPDFOne from "@/components/PDF/contractPDFOne.vue";
  77. import byTable from "@/components/byTable/index";
  78. const { proxy } = getCurrentInstance();
  79. const props = defineProps({
  80. contractId: String,
  81. });
  82. const activeName = ref("first");
  83. const currentItem = ref({});
  84. const rowData = ref({});
  85. const rowDataOne = ref({});
  86. const leftList = ref([]);
  87. const contractDataList = ref([]);
  88. const purchaseDataList = ref([]);
  89. const tableData = ref([]);
  90. const transactionType = ref([
  91. {
  92. label: "请款",
  93. value: "1",
  94. },
  95. {
  96. label: "采购付款",
  97. value: "20",
  98. },
  99. {
  100. label: "到账认领",
  101. value: "30",
  102. },
  103. ]);
  104. const config = computed(() => {
  105. return [
  106. {
  107. attrs: {
  108. label: "交易时间",
  109. prop: "createTime",
  110. width: 155,
  111. },
  112. },
  113. {
  114. attrs: {
  115. label: "交易类型",
  116. prop: "type",
  117. width: 80,
  118. },
  119. render(type) {
  120. return proxy.dictValueLabel(type, transactionType.value);
  121. },
  122. },
  123. {
  124. attrs: {
  125. label: "交易金额",
  126. prop: "amount",
  127. slot: "amount",
  128. width: 130,
  129. },
  130. },
  131. {
  132. attrs: {
  133. label: "摘要",
  134. prop: "remarks",
  135. },
  136. },
  137. {
  138. attrs: {
  139. label: "资金账户",
  140. prop: "accountManagementName",
  141. slot: "accountManagementName",
  142. },
  143. },
  144. {
  145. attrs: {
  146. label: "对方账户",
  147. prop: "name",
  148. width: 120,
  149. },
  150. },
  151. ];
  152. });
  153. const handleClick = () => {};
  154. const handleItemClick = (item) => {
  155. currentItem.value = item;
  156. if (activeName.value === "first") {
  157. rowData.value = {
  158. id: item.id,
  159. };
  160. } else if (activeName.value === "second") {
  161. rowDataOne.value = {
  162. id: item.id,
  163. };
  164. }
  165. };
  166. const pushProcessApproval = (row) => {
  167. proxy.$router.push({
  168. path: "/platform_manage/process/processApproval",
  169. query: {
  170. flowKey: "contract_flow",
  171. id: row.flowId,
  172. processType: 20,
  173. random: proxy.random(),
  174. flowName: "销售合同详情",
  175. },
  176. });
  177. return;
  178. };
  179. const handleChange = (val) => {
  180. if (val === "first") {
  181. leftList.value = contractDataList.value;
  182. }
  183. if (val === "second") {
  184. leftList.value = purchaseDataList.value;
  185. }
  186. if (leftList.value && leftList.value.length > 0) {
  187. handleItemClick(leftList.value[0]);
  188. }
  189. };
  190. const getDetailsData = () => {
  191. proxy
  192. .post("/contract/getVersionList", { id: props.contractId })
  193. .then((res) => {
  194. contractDataList.value = res;
  195. leftList.value = contractDataList.value;
  196. if (contractDataList.value && contractDataList.value.length > 0) {
  197. handleItemClick(contractDataList.value[0]);
  198. }
  199. });
  200. proxy
  201. .post("/contract/getPurchaseListByContractId", { id: props.contractId })
  202. .then((res) => {
  203. purchaseDataList.value = res;
  204. });
  205. proxy
  206. .post("/contract/getAccountRunningWaterByContractId", {
  207. id: props.contractId,
  208. })
  209. .then((res) => {
  210. tableData.value = res;
  211. });
  212. };
  213. getDetailsData();
  214. </script>
  215. <style lang="scss" scoped>
  216. .content-box {
  217. display: flex;
  218. .left {
  219. width: 100px;
  220. // background: #ccc;
  221. .left-item {
  222. height: 36px;
  223. line-height: 36px;
  224. text-align: center;
  225. cursor: pointer;
  226. }
  227. }
  228. .right {
  229. width: calc(100% - 100px);
  230. padding-left: 10px;
  231. }
  232. }
  233. .baseRow {
  234. min-height: 24px;
  235. border-top: 1px solid black;
  236. border-left: 1px solid black;
  237. }
  238. .contentRow {
  239. border-right: 1px solid black;
  240. line-height: 24px;
  241. padding-left: 4px;
  242. }
  243. </style>