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