|
|
@ -16,23 +16,25 @@ |
|
|
|
<a-button type="link">删除</a-button> |
|
|
|
</a-popconfirm> |
|
|
|
<a-button type="link" @click="handleDetail(record.id)">详情</a-button> |
|
|
|
<a-button type="link" @click="download(record)" v-if="record.attachment">下载</a-button> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</BasicTable> |
|
|
|
<detailDrawer ref="detailDrawerRef" /> |
|
|
|
<addModal ref="addModalRef" @success="reload()"/> |
|
|
|
<addModal ref="addModalRef" @success="reload()" /> |
|
|
|
</PageWrapper> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import { PageWrapper } from '@/components/Page'; |
|
|
|
import { BasicTable, useTable } from '@/components/Table'; |
|
|
|
import { list, removeByIds,getDocumentType} from './api'; |
|
|
|
import { list, removeByIds, getDocumentType } from './api'; |
|
|
|
import { formSchemas, columns } from './data'; |
|
|
|
import detailDrawer from './detailDrawer.vue'; |
|
|
|
import { ref,onMounted } from 'vue'; |
|
|
|
import { ref, onMounted } from 'vue'; |
|
|
|
import addModal from './addModal.vue'; |
|
|
|
|
|
|
|
import { commonDownload } from '@/api/common/index'; |
|
|
|
import { downloadByData } from '@/utils/file/download'; |
|
|
|
defineOptions({ name: 'Document' }); |
|
|
|
|
|
|
|
const [registerTable, { reload }] = useTable({ |
|
|
@ -56,7 +58,7 @@ |
|
|
|
}, |
|
|
|
columns: columns, |
|
|
|
actionColumn: { |
|
|
|
width: 200, |
|
|
|
width: 270, |
|
|
|
title: '操作', |
|
|
|
key: 'action', |
|
|
|
fixed: 'right', |
|
|
@ -82,16 +84,26 @@ |
|
|
|
}; |
|
|
|
const getDocumentTypeOptions = async () => { |
|
|
|
const res = await getDocumentType(); |
|
|
|
formSchemas[0].componentProps.options = res.rows; |
|
|
|
formSchemas[0].componentProps.options .forEach((i:any)=>{ |
|
|
|
i.value = i.typeName, |
|
|
|
i.label = i.typeName |
|
|
|
}) |
|
|
|
|
|
|
|
formSchemas[0].componentProps.options = res.rows; |
|
|
|
formSchemas[0].componentProps.options.forEach((i: any) => { |
|
|
|
(i.value = i.typeName), (i.label = i.typeName); |
|
|
|
}); |
|
|
|
}; |
|
|
|
//下载 |
|
|
|
const download = async (record:any) => { |
|
|
|
const attachments = JSON.parse(record.attachment) |
|
|
|
if (attachments && attachments.length > 0) { |
|
|
|
attachments.forEach((i: any) => { |
|
|
|
commonDownload(i.url).then((res) => { |
|
|
|
const data = res; |
|
|
|
downloadByData(data, i.name); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
onMounted(()=>{ |
|
|
|
getDocumentTypeOptions() |
|
|
|
}) |
|
|
|
onMounted(() => { |
|
|
|
getDocumentTypeOptions(); |
|
|
|
}); |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped></style> |
|
|
|