AssetDetail.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <CommonTable ref="typeTable" :have-page="false" :columns="assetColumns" :data-source="assetDatas">
  3. <template #title>资产详情</template>
  4. <template #bodyCell="{ column }">
  5. <template v-if="column.dataIndex === 'operation'">
  6. <a-button type="link" @click="viewDetail">资产明细</a-button>
  7. </template>
  8. </template>
  9. </CommonTable>
  10. <a-modal v-model:open="open" width="75%" :footer="null" title="查看明细" @cancel="open = false">
  11. <component
  12. :is="dynamicComponent" v-if="open" :info-window-no="infoWindowNo"
  13. :where-clause-source="whereClauseSource" :is-search-widget="true"
  14. />
  15. </a-modal>
  16. </template>
  17. <script setup>
  18. import { queryByIdApi } from './api.js';
  19. import { message } from 'ant-design-vue';
  20. import Common from '../../common/Common.js';
  21. import { InfoWindow } from 'pc-component-v3';
  22. import { assetColumn } from './assetConfig.js';
  23. import { ref, defineProps, defineEmits, watch } from 'vue';
  24. import CommonTable from '../assetsDisposal/AssetCommonTable.vue';
  25. const emits = defineEmits(['getEvaluateValue']);
  26. const props = defineProps({
  27. disposalId: {
  28. type: String,
  29. default: null,
  30. },
  31. selectAssetIds: {
  32. type: Array,
  33. default: () => [],
  34. },
  35. isReadonly: {
  36. type: Boolean,
  37. default: false,
  38. },
  39. readDatas: {
  40. type: Object,
  41. default: null,
  42. },
  43. });
  44. const open = ref(false);
  45. const dynamicComponent = ref(null);
  46. const infoWindowNo = ref('20241103_160417');
  47. const whereClauseSource = ref(null);
  48. const assetDatas = ref([]);
  49. const assetColumns = ref(assetColumn);
  50. // 查看明细
  51. const viewDetail = () => {
  52. whereClauseSource.value = {
  53. customWhere: 'adp.id IS NOT NULL AND adp.id = ' + props.disposalId,
  54. };
  55. dynamicComponent.value = InfoWindow;
  56. open.value = true;
  57. };
  58. // 查询资产详情
  59. const queryAsset = () => {
  60. const params = {
  61. ids: props.selectAssetIds,
  62. recordId: props.disposalId,
  63. };
  64. queryByIdApi(params).then(
  65. success => {
  66. if (success.errorCode === 0) {
  67. const { approvalAmount, choiceDisposedAmount, evaluateValue } = success.data;
  68. if (approvalAmount !== null && approvalAmount !== undefined) success.data.approvalAmount = approvalAmount.toFixed(2);
  69. if (choiceDisposedAmount !== null && choiceDisposedAmount !== undefined) success.data.choiceDisposedAmount = choiceDisposedAmount.toFixed(2);
  70. if (evaluateValue !== null && evaluateValue !== undefined) success.data.evaluateValue = evaluateValue.toFixed(2);
  71. assetDatas.value = [success.data];
  72. emits('getEvaluateValue', success.data.evaluateValue);
  73. } else {
  74. message.warning(success.errorMessage);
  75. }
  76. },
  77. error => {
  78. Common.processException(error);
  79. },
  80. );
  81. };
  82. watch(() => props.disposalId, (newValue, oldValue) => {
  83. if (newValue !== oldValue) {
  84. if (!props.isReadonly) {
  85. queryAsset();
  86. } else {
  87. if (props.readDatas) {
  88. assetDatas.value = [props.readDatas.assetDetailsVo];
  89. }
  90. }
  91. }
  92. }, { immediate: true });
  93. </script>
  94. <style scoped></style>