|
@@ -74,12 +74,12 @@
|
|
|
<hc-dialog v-model="isImportShow" widths="24rem" title="项目数据导入" :footer="false" @close="modalImportClose">
|
|
|
<hc-form-upload
|
|
|
v-model="importFile" class="hc-form-drop-upload"
|
|
|
- :options="{ num: 0, type: 'list', drop: true }"
|
|
|
- :upload="{ options: uploadOptions }"
|
|
|
+ :options="{ num: 1, type: 'list', drop: true }"
|
|
|
+ :upload="{ options: uploadOptions }" @success="uploadSuccess"
|
|
|
/>
|
|
|
<div class="hc-flex mt-5">
|
|
|
<span class="mr-2">模板下载:</span>
|
|
|
- <el-button color="#20C98B" size="small" class="text-white">点击下载</el-button>
|
|
|
+ <el-button color="#20C98B" size="small" class="text-white" :loading="downloadTemplateLoading" @click="downloadTemplate">点击下载</el-button>
|
|
|
</div>
|
|
|
</hc-dialog>
|
|
|
</hc-card>
|
|
@@ -88,19 +88,18 @@
|
|
|
<script setup>
|
|
|
import { onMounted, ref } from 'vue'
|
|
|
import HcTableList from '../modules/project-list.vue'
|
|
|
-import { arrToId, getArrValue } from 'js-fast-way'
|
|
|
-import mainApi from '~api/project/project'
|
|
|
+import { arrToId, getArrValue, newDownBlob } from 'js-fast-way'
|
|
|
import { getDictionaryData } from '~src/utils/tools'
|
|
|
+import mainApi from '~api/project/project'
|
|
|
+import { useClick } from 'hc-vue3-ui'
|
|
|
|
|
|
//事件
|
|
|
const emit = defineEmits(['edit'])
|
|
|
//渲染完成
|
|
|
onMounted(async () => {
|
|
|
-
|
|
|
- await getProStation()
|
|
|
- await getProType()
|
|
|
- getTableData()
|
|
|
-
|
|
|
+ await getProStation()
|
|
|
+ await getProType()
|
|
|
+ getTableData().then()
|
|
|
})
|
|
|
const tableRef = ref(null)
|
|
|
const buildTotal = ref(0)
|
|
@@ -162,7 +161,6 @@ const rowNameClick = (row) => {
|
|
|
emit('edit', row)
|
|
|
}
|
|
|
|
|
|
-//批量删除
|
|
|
//批量删除
|
|
|
const delTableItem = async (_, resolve) => {
|
|
|
const ids = arrToId(tableCheckKeys.value)
|
|
@@ -172,15 +170,22 @@ const delTableItem = async (_, resolve) => {
|
|
|
resolve()
|
|
|
searchClick()
|
|
|
} else {
|
|
|
-
|
|
|
window.$message.error(msg ?? '删除失败')
|
|
|
resolve()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//批量导出
|
|
|
-const deriveTableItem = (_, resolve) => {
|
|
|
- tableRef.value?.batchExport()
|
|
|
+const deriveTableItem = async (_, resolve) => {
|
|
|
+ /*const ids = arrToId(tableCheckKeys.value)
|
|
|
+ const { error, val } = await mainApi.exportWorkfocus(ids)
|
|
|
+ if (error) {
|
|
|
+ window.$message?.error('数据异常')
|
|
|
+ resolve()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ await newDownBlob(val)*/
|
|
|
+ window.$message?.error('暂未开放')
|
|
|
resolve()
|
|
|
}
|
|
|
|
|
@@ -221,6 +226,8 @@ const reportsModalClose = () => {
|
|
|
const isImportShow = ref(false)
|
|
|
const importFile = ref([])
|
|
|
const uploadOptions = {
|
|
|
+ url: '/api/blade-attach/project/import-project',
|
|
|
+ size: 120,
|
|
|
accept: '.xls,.xlsx',
|
|
|
accept_tip: '请选择Excel文件',
|
|
|
}
|
|
@@ -232,6 +239,28 @@ const importClick = () => {
|
|
|
const modalImportClose = () => {
|
|
|
isImportShow.value = false
|
|
|
}
|
|
|
+
|
|
|
+//下载模板
|
|
|
+const downloadTemplateLoading = ref(false)
|
|
|
+const downloadTemplate = async () => {
|
|
|
+ await useClick() //这里要使用 await 来等待
|
|
|
+ downloadTemplateLoading.value = true
|
|
|
+ const { error, val } = await mainApi.exportTemplate()
|
|
|
+ downloadTemplateLoading.value = false
|
|
|
+ if (error) {
|
|
|
+ window.$message?.error('数据异常')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ await newDownBlob(val)
|
|
|
+}
|
|
|
+
|
|
|
+//上传完成
|
|
|
+const uploadSuccess = () => {
|
|
|
+ setTimeout(() => {
|
|
|
+ getTableData()
|
|
|
+ modalImportClose()
|
|
|
+ }, 1000)
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|