ViewFileListModal.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div ref="viewFileDetailRef">
  3. <a-modal
  4. :title="title"
  5. width="60%"
  6. :visible="visible"
  7. :maskClosable="false"
  8. :getContainer="() => $refs.viewFileDetailRef"
  9. switchFullscreen
  10. :footer="false"
  11. @cancel="handleCancel"
  12. >
  13. <div>
  14. <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined" style="margin-bottom: 1%"> 新增(add)</a-button>
  15. <a-table
  16. :columns="columns"
  17. :row-key="(record) => record.id"
  18. :data-source="dataSource"
  19. bordered
  20. size="small"
  21. height="500"
  22. :pagination="false"
  23. :scroll="{ x: 1000, y: 500 }"
  24. >
  25. <template #operation="{ text, record, index }">
  26. <a @click="handleEdit(record)">编辑(edit)</a>
  27. <a-divider type="vertical" />
  28. <a-popconfirm title="确定删除吗?" @confirm="handleDelete(record)">
  29. <a>删除(delete)</a>
  30. </a-popconfirm>
  31. </template>
  32. </a-table>
  33. </div>
  34. </a-modal>
  35. <FileUploadModal ref="FileUploadModalRef" @add-list="loadData" />
  36. </div>
  37. </template>
  38. <script lang="ts" setup>
  39. import { ref } from 'vue';
  40. import { defHttp } from '/@/utils/http/axios';
  41. import FileUploadModal from './FileUploadModal.vue';
  42. import { message } from 'ant-design-vue';
  43. var visible = ref(false);
  44. var title = ref('');
  45. var fatherId = ref('');
  46. var fatherTitle = ref('');
  47. var FileUploadModalRef = ref();
  48. var params = ref({
  49. headId: '',
  50. type: '',
  51. pageSize: '-1',
  52. });
  53. var columns = ref([
  54. {
  55. title: '上传时间(upload time)',
  56. align: 'center',
  57. dataIndex: 'createTime',
  58. key: 'createTime',
  59. },
  60. {
  61. title: '名称(name)',
  62. align: 'center',
  63. dataIndex: 'name',
  64. key: 'name',
  65. },
  66. {
  67. title: '操作(operation)',
  68. align: 'center',
  69. dataIndex: 'operation',
  70. key: 'operation',
  71. slots: { customRender: 'operation' },
  72. },
  73. ]);
  74. var dataSource = ref([]);
  75. function loadData() {
  76. defHttp.get({ url: '/saleCode/saleOrderFiles/list', params: params.value }).then((res) => {
  77. if (res) {
  78. dataSource.value = res.records;
  79. }
  80. });
  81. }
  82. function getTable(dataIndex, record) {
  83. visible.value = true;
  84. title.value = dataIndex == 'scanProtocaol' ? '扫描合同查看(view scan contract)' : '技术协议查看(view T/A)';
  85. fatherId.value = record.id;
  86. fatherTitle.value = dataIndex;
  87. params.value.headId = record.id;
  88. params.value.type = dataIndex == 'scanProtocaol' ? '1' : '2';
  89. loadData();
  90. }
  91. function handleCancel() {
  92. visible.value = false;
  93. }
  94. function handleAdd() {
  95. FileUploadModalRef.value.getTable(fatherId, fatherTitle, 'add');
  96. }
  97. function handleEdit(record) {
  98. FileUploadModalRef.value.getTable(fatherId, fatherTitle, 'edit', record.id);
  99. }
  100. function handleDelete(record) {
  101. let params = { id: record.id };
  102. defHttp.delete({ url: '/saleCode/saleOrderFiles/delete', params }, { joinParamsToUrl: true, isTransformResponse: false }).then((res) => {
  103. if (res) {
  104. loadData();
  105. } else {
  106. message.warning(res.message);
  107. }
  108. });
  109. }
  110. defineExpose({
  111. getTable,
  112. });
  113. </script>
  114. <style lang="less" scoped>
  115. /** 时间和数字输入框样式 */
  116. :deep(.ant-input-number) {
  117. width: 100%;
  118. }
  119. :deep(.ant-calendar-picker) {
  120. width: 100%;
  121. }
  122. /deep/.ant-modal-body {
  123. padding: 14px !important;
  124. }
  125. </style>