index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <!-- 现货合同详情-->
  3. <a-modal class="add-custom custom-detail" title="现货合同详情" v-model:visible="visible" centered :maskClosable="false"
  4. @cancel="cancel(false)" width="890px">
  5. <template #footer>
  6. <a-button key="submit" type="primary" :loading="loading" @click="cancel(false)">关闭</a-button>
  7. </template>
  8. <a-tabs v-model:activeKey="activeKey" @change="tabClick">
  9. <a-tab-pane v-for="item in tabList" :key="item.key" :tab="item.name"></a-tab-pane>
  10. </a-tabs>
  11. <InfoDetail :selectedRow="selectedRow" v-if="activeKey == 1" />
  12. <div class="tableDatas" v-else>
  13. <a-table class="dialogTable" :columns="columns" :data-source="tableList" :pagination="false">
  14. <template #status="{ text }">
  15. <span class="yellow">{{ text }}</span>
  16. <!-- 审核通过'green' 审核拒绝 'orange' 待审核'yellow' -->
  17. </template>
  18. <!-- 审核状态 -->
  19. <template #applystatus="{ text }">
  20. <a>{{ getApplyStatusName(text) }}</a>
  21. </template>
  22. <!-- 发票金额-->
  23. <template #invoicetype="{ text }">
  24. <a>{{ invoiceStatusName(text) }}</a>
  25. </template>
  26. <!-- 发票类型-->
  27. <template #contracttype="{ text }">
  28. <a>{{ getReceiptName(text) }}</a>
  29. </template>
  30. <!-- 出入库类型 -->
  31. <template #inouttype="{ text }">
  32. <a>{{ InOutTypeName(text) }}</a>
  33. </template>
  34. <!-- 款项类型 -->
  35. <template #kxtype="{ record }">
  36. <a>{{ stateName(record.deductamount, record.contracttype) }}</a>
  37. </template>
  38. <!-- 金额-->
  39. <template #payamount="{ text, record }">
  40. <span>{{ formatValue(record.kxtype === 2 ? record.deductamount : text) }}</span>
  41. </template>
  42. <!-- 调整付保证金-->
  43. <template #addmargin="{ record }">
  44. <span>{{ formatValue(record.addmargin === undefined || '' ? record.decmargin : record.addmargin) }}</span>
  45. </template>
  46. <!-- 交收量 -->
  47. <template #reckonrealqty="{ record }">
  48. <span>{{ formatValue(record.reckonrealqty) }}</span>
  49. </template>
  50. <!-- 其他费用 -->
  51. <template #reckonotheramount="{ record }">
  52. <span>{{ formatValue(record.reckonotheramount) }}</span>
  53. </template>
  54. <!-- 调整金额 -->
  55. <template #reckonadjustamount="{ record }">
  56. <span>{{ formatValue(record.reckonadjustamount) }}</span>
  57. </template>
  58. <!-- 申请人 -->
  59. <template #applyname="{ record }">
  60. <span>{{ formatValue(record.applyname) }}</span>
  61. </template>
  62. <template #warehousename="{ record }">
  63. {{ record.warehousecode }}
  64. </template>
  65. <!-- 套期类型 -->
  66. <template #hedgedtype="{ text }">
  67. <span>{{ getHedgedTypeName(text) }}</span>
  68. </template>
  69. <!-- 款项记录 款项类型为退款 则金额使用deductamount-->
  70. </a-table>
  71. </div>
  72. </a-modal>
  73. </template>
  74. <script lang="ts">
  75. import { defineComponent, PropType, ref } from 'vue';
  76. import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
  77. import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  78. import { QueryBusinessFp, QueryBusinessKx } from '@/services/go/ermcp/finance-review';
  79. import { QueryBusinessDj, QueryBusinessJs } from '@/services/go/ermcp/business-review';
  80. import { QueryAreaStockApply } from '@/services/go/ermcp/inventory-review';
  81. import { QueryChangeLog } from '@/services/go/ermcp/spot-contract';
  82. import { queryErmcp2HedgedItemLink } from '@/services/go/ermcp/hedgedItem';
  83. import InfoDetail from '../infoDetail/index.vue';
  84. import { getApplyStatusName, getReceiptName } from '@/common/constants/enumsName';
  85. import { getTableColumns } from '@/common/setup/table';
  86. import { invoiceStatusName, stateName } from '@/views/manage/finance-review/setup';
  87. import { getPlanContractType } from '@/views/business/plan/setup';
  88. import { InOutTypeName } from '@/views/manage/inventory-review/setup';
  89. import { kxtypeName } from '@/views/manage/finance-review/setup';
  90. import { _closeModal } from '@/common/setup/modal/modal';
  91. import { formatValue } from '@/common/methods';
  92. import { getHedgedTypeName } from '@/@next/constants/enum/hedgedType'
  93. export default defineComponent({
  94. name: 'spot-contract-detail',
  95. components: { InfoDetail },
  96. emits: ['cancel', 'update'],
  97. props: {
  98. selectedRow: {
  99. type: Object as PropType<Ermcp3ContractRsp>,
  100. default: {},
  101. },
  102. },
  103. setup(props, context) {
  104. const { visible, cancel } = _closeModal(context);
  105. const tabList = ref<{ key: number; name: string }[]>([]);
  106. const activeKey = ref<number>(1);
  107. const loading = ref<boolean>(false);
  108. const tableList = ref<any[]>([]);
  109. // 表头数据
  110. const { columns, registerColumn } = getTableColumns();
  111. // 审核拒绝和未提交不显示后面的选项
  112. tabList.value = [0, 4, 6].includes(props.selectedRow.contracctstatus)
  113. ? [{ key: 1, name: '合同详情' }]
  114. : [
  115. { key: 1, name: '合同详情' },
  116. { key: 2, name: '点价记录' },
  117. { key: 3, name: '交收记录' },
  118. { key: 4, name: '款项记录' },
  119. { key: 5, name: '发票记录' },
  120. { key: 6, name: props.selectedRow.contracttype === 1 ? '入库记录' : '出库记录' },
  121. { key: 7, name: '变更记录' },
  122. { key: 8, name: '关联记录' },
  123. ];
  124. activeKey.value = 1;
  125. function tabClick() {
  126. const { spotcontractid, contracttype } = props.selectedRow;
  127. switch (activeKey.value) {
  128. case 2: // 点价记录
  129. registerColumn('table_pcweb_someprice_detail_dj');
  130. queryResultLoadingAndInfo(QueryBusinessDj, loading, { relatedid: spotcontractid }).then((res) => {
  131. tableList.value = res;
  132. });
  133. break;
  134. case 3: // 交收记录
  135. registerColumn('table_pcweb_someprice_detail_js');
  136. queryResultLoadingAndInfo(QueryBusinessJs, loading, { relatedid: spotcontractid }).then((res) => {
  137. tableList.value = res;
  138. });
  139. break;
  140. case 4: //款项记录
  141. registerColumn('table_pcweb_someprice_detail_kx');
  142. queryResultLoadingAndInfo(QueryBusinessKx, loading, { relatedid: spotcontractid }).then((res) => {
  143. tableList.value = res;
  144. });
  145. break;
  146. case 5: // 发票记录
  147. registerColumn('table_pcweb_someprice_detail_fp');
  148. queryResultLoadingAndInfo(QueryBusinessFp, loading, { relatedid: spotcontractid }).then((res) => {
  149. tableList.value = res;
  150. });
  151. break;
  152. case 6: // 出入库记录
  153. const inouttype = contracttype === 1 ? '5' : '6';
  154. if (contracttype === 1) {
  155. registerColumn('table_pcweb_someprice_detail_stock');
  156. } else {
  157. registerColumn('table_pcweb_someprice_detail_stock_out');
  158. }
  159. queryResultLoadingAndInfo(QueryAreaStockApply, loading, {
  160. spotcontractid,
  161. inouttype,
  162. }).then((res) => {
  163. tableList.value = res;
  164. });
  165. break;
  166. case 7: // 变更记录
  167. registerColumn('table_pcweb_someprice_detail_change');
  168. queryResultLoadingAndInfo(QueryChangeLog, loading, { RelatedId: spotcontractid }).then((res) => {
  169. tableList.value = res;
  170. });
  171. break;
  172. case 8: // 关联记录
  173. registerColumn('table_pcweb_someprice_detail_link');
  174. queryResultLoadingAndInfo(queryErmcp2HedgedItemLink, loading, { spotcontractid }).then((res) => {
  175. tableList.value = res;
  176. });
  177. break;
  178. }
  179. }
  180. return {
  181. visible,
  182. cancel,
  183. loading,
  184. maskClosableFlag: false,
  185. activeKey,
  186. columns,
  187. tableList,
  188. tabList,
  189. tabClick,
  190. getApplyStatusName,
  191. invoiceStatusName,
  192. getPlanContractType,
  193. InOutTypeName,
  194. kxtypeName,
  195. formatValue,
  196. getReceiptName,
  197. getHedgedTypeName,
  198. stateName,
  199. };
  200. },
  201. });
  202. </script>
  203. <style lang="less">
  204. .custom-detail {
  205. .ant-modal-content {
  206. .ant-modal-body {
  207. padding-top: 0;
  208. padding-left: 0;
  209. padding-right: 0;
  210. .ant-tabs {
  211. background: @m-black11;
  212. width: 100%;
  213. padding: 0 24px;
  214. .ant-tabs-bar {
  215. margin-bottom: 0;
  216. border-bottom: 0;
  217. }
  218. .anticon {
  219. color: @m-grey2;
  220. }
  221. .ant-tabs-nav-container {
  222. .ant-tabs-nav-wrap {
  223. .ant-tabs-nav {
  224. .ant-tabs-tab {
  225. width: 70px;
  226. margin-right: 43px;
  227. text-align: center;
  228. font-size: 16px;
  229. color: @m-grey2;
  230. padding: 0;
  231. line-height: 45px;
  232. }
  233. .ant-tabs-tab-active.ant-tabs-tab {
  234. color: @m-blue0;
  235. }
  236. .ant-tabs-ink-bar {
  237. width: 70px !important;
  238. background: @m-blue0;
  239. .rounded-corners(1px);
  240. }
  241. }
  242. }
  243. }
  244. }
  245. }
  246. }
  247. .tableDatas {
  248. margin-top: 26px;
  249. padding: 0 24px;
  250. overflow: hidden;
  251. .dialogTable {
  252. width: 100%;
  253. overflow: overlay;
  254. }
  255. }
  256. .ant-form.inlineForm {
  257. margin-top: 20px;
  258. padding: 0 24px;
  259. }
  260. }
  261. </style>