AssetDetail.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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">资产明细</a-button>
  7. </template>
  8. </template>
  9. </CommonTable>
  10. </template>
  11. <script setup>
  12. import { queryByIdApi } from './api.js';
  13. import Common from '../common/Common.js';
  14. import { message } from 'ant-design-vue';
  15. import { assetColumn } from './assetConfig.js';
  16. import { ref, defineProps, defineEmits, watch } from 'vue';
  17. import CommonTable from '../assetsDisposal/AssetCommonTable.vue';
  18. const emits = defineEmits(['getEvaluateValue']);
  19. const props = defineProps({
  20. disposalId: {
  21. type: String,
  22. default: null,
  23. },
  24. selectAssetIds: {
  25. type: Array,
  26. default: () => [],
  27. },
  28. isReadonly: {
  29. type: Boolean,
  30. default: false,
  31. },
  32. readDatas: {
  33. type: Object,
  34. default: null,
  35. },
  36. });
  37. const assetDatas = ref([]);
  38. const assetColumns = ref(assetColumn);
  39. // 查询资产详情
  40. const queryAsset = () => {
  41. const params = {
  42. ids: props.selectAssetIds,
  43. recordId: props.disposalId,
  44. };
  45. queryByIdApi(params).then(
  46. success => {
  47. if (success.errorCode === 0) {
  48. const { approvalAmount, choiceDisposedAmount, evaluateValue } = success.data;
  49. if (approvalAmount !== null && approvalAmount !== undefined) success.data.approvalAmount = approvalAmount.toFixed(2);
  50. if (choiceDisposedAmount !== null && choiceDisposedAmount !== undefined) success.data.choiceDisposedAmount = choiceDisposedAmount.toFixed(2);
  51. if (evaluateValue !== null && evaluateValue !== undefined) success.data.evaluateValue = evaluateValue.toFixed(2);
  52. assetDatas.value = [success.data];
  53. emits('getEvaluateValue', success.data.evaluateValue);
  54. } else {
  55. message.warning(success.errorMessage);
  56. }
  57. },
  58. error => {
  59. Common.processException(error);
  60. },
  61. );
  62. };
  63. watch(() => props.disposalId, (newValue, oldValue) => {
  64. if (newValue !== oldValue) {
  65. if (!props.isReadonly) {
  66. queryAsset();
  67. } else {
  68. if (props.readDatas) {
  69. assetDatas.value = [props.readDatas.assetDetailsVo];
  70. }
  71. }
  72. }
  73. }, { immediate: true });
  74. </script>
  75. <style scoped></style>