|
@@ -7,6 +7,7 @@ import {
|
|
|
NDatePicker,
|
|
|
NDescriptions,
|
|
|
NDescriptionsItem,
|
|
|
+ NDropdown,
|
|
|
NFormItem,
|
|
|
NImage,
|
|
|
NInput,
|
|
@@ -341,6 +342,7 @@ export default defineComponent({
|
|
|
|
|
|
const customRequest_importData = reactive({
|
|
|
loading: false,
|
|
|
+ dataType: 'COURSEWARE',
|
|
|
importRef: null as any
|
|
|
})
|
|
|
const customRequest_importFile = async (data: UploadCustomRequestOptions) => {
|
|
@@ -349,11 +351,10 @@ export default defineComponent({
|
|
|
try {
|
|
|
const fileUrl = await api_uploadFile(data.file.file, () => {})
|
|
|
const res = await api_openFileImportInfoSave({
|
|
|
- dataType: 'COURSEWARE',
|
|
|
+ dataType: customRequest_importData.dataType,
|
|
|
fileName: data.file.name,
|
|
|
importUrl: fileUrl
|
|
|
})
|
|
|
- console.log('🚀 ~ res:', res)
|
|
|
customRequest_importData.loading = false
|
|
|
if (res.data) {
|
|
|
// 空表格
|
|
@@ -472,19 +473,30 @@ export default defineComponent({
|
|
|
</NButton>
|
|
|
<div v-auth="Importcourseware1793540542561292290">
|
|
|
<NUpload
|
|
|
+ multiple={false}
|
|
|
ref={(el: any) => (customRequest_importData.importRef = el)}
|
|
|
showFileList={false}
|
|
|
accept=".xlsx"
|
|
|
customRequest={customRequest_importFile}
|
|
|
>
|
|
|
- <NButton
|
|
|
- type="primary"
|
|
|
- onClick={() => {
|
|
|
+ <NDropdown
|
|
|
+ size="huge"
|
|
|
+ trigger="hover"
|
|
|
+ options={[
|
|
|
+ { label: '课件', key: 'COURSEWARE' },
|
|
|
+ { label: '素材关联曲目', key: 'COURSEWARE_REF_MATERIAL' }
|
|
|
+ ]}
|
|
|
+ onSelect={(key: string) => {
|
|
|
+ customRequest_importData.dataType = key
|
|
|
+ console.log(customRequest_importData.importRef)
|
|
|
customRequest_importData.importRef?.clear()
|
|
|
+ customRequest_importData.importRef?.openOpenFileDialog()
|
|
|
}}
|
|
|
>
|
|
|
- 导入课件
|
|
|
- </NButton>
|
|
|
+ <NButton type="primary" onClick={(e: Event) => e.stopPropagation()}>
|
|
|
+ 导入数据
|
|
|
+ </NButton>
|
|
|
+ </NDropdown>
|
|
|
</NUpload>
|
|
|
</div>
|
|
|
</NSpace>
|