|
@@ -156,11 +156,18 @@
|
|
|
<div class="table-tip-foot">
|
|
|
<div class="tip-left-btn">
|
|
|
<HcTooltip keys="wbs_import_table">
|
|
|
- <div class="text-gray-400 dow-text" @click="importModal">
|
|
|
+ <div class="text-main dow-text" @click="uploadFileClick(item)">
|
|
|
<HcIcon name="publish" ui="text-lg" />
|
|
|
<span class="ml-1">导入列表数据</span>
|
|
|
</div>
|
|
|
</HcTooltip>
|
|
|
+ <HcUploadFile
|
|
|
+ ref="dataHcUploadFileRef"
|
|
|
+ :params="{ pKeyId: checkItem.pkeyId }"
|
|
|
+ :options="UploadFileOptions"
|
|
|
+ multiple="false"
|
|
|
+ @success="HcUploadFileSuccess"
|
|
|
+ />
|
|
|
<HcTooltip keys="wbs_download_table">
|
|
|
<div class="text-main dow-text" @click="downModal(item)">
|
|
|
<HcIcon name="file_download" ui="text-lg" />
|
|
@@ -405,6 +412,7 @@ import {
|
|
|
getArrValue, getObjVal, getObjValue, isNullES, setPosRange,
|
|
|
} from 'js-fast-way'
|
|
|
import { delMessageV2 } from '~com/message/index.js'
|
|
|
+import { getTokenHeader } from '~src/api/request/header'
|
|
|
//参数
|
|
|
const props = defineProps({
|
|
|
datas: {
|
|
@@ -1503,8 +1511,38 @@ const setActiveKey = (key) => {
|
|
|
return ActiveKey.value = key
|
|
|
}
|
|
|
//导入模板
|
|
|
-const importModal = ()=>{
|
|
|
|
|
|
+
|
|
|
+const dataHcUploadFileRef = ref(null)
|
|
|
+const checkItem = ref({})
|
|
|
+//打开文件选择框
|
|
|
+const uploadFileClick = (item) => {
|
|
|
+ checkItem.value = item
|
|
|
+ dataHcUploadFileRef?.value[0]?.cancelUpload()
|
|
|
+ dataHcUploadFileRef?.value[0].selectFile()
|
|
|
+}
|
|
|
+//上传配置
|
|
|
+const UploadFileOptions = {
|
|
|
+ //此处设置header
|
|
|
+ headers: getTokenHeader(),
|
|
|
+ url: '/api/blade-manager/wbsTreeContract/import-excel',
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// 文件上传成功的回调
|
|
|
+const HcUploadFileSuccess = async (res) => {
|
|
|
+ const { resData } = res
|
|
|
+ const { pkeyId } = checkItem.value
|
|
|
+ const refs = await getFormRef(pkeyId)
|
|
|
+ refs?.setFormData(resData)
|
|
|
+ dataHcUploadFileRef.value[0]?.setModalShow(false)
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// 文件全部上传成功
|
|
|
+const HcUploadFileChange = () => {
|
|
|
+ console.log('文件全部上传成功')
|
|
|
+
|
|
|
}
|
|
|
const downloadLoading = ref(false)
|
|
|
const getdownloadExcel = async (pKeyId)=>{
|
|
@@ -1523,24 +1561,25 @@ const getdownloadExcel = async (pKeyId)=>{
|
|
|
//下载模板
|
|
|
const downModal = (item)=>{
|
|
|
const { pkeyId } = item
|
|
|
- if (isStatus.value === 3) {
|
|
|
- window?.$messageBox?.alert('是否选择把数据一起导出?', '下载模板', {
|
|
|
- showCancelButton: true,
|
|
|
- confirmButtonText: '是',
|
|
|
- cancelButtonText: '否',
|
|
|
- callback: (action) => {
|
|
|
- if (action === 'confirm') {
|
|
|
- console.log('数据')
|
|
|
- } else if ( action === 'cancel') {
|
|
|
- console.log('清表')
|
|
|
- getdownloadExcel(pkeyId)
|
|
|
- }
|
|
|
- },
|
|
|
- })
|
|
|
- } else {
|
|
|
- console.log('清表')
|
|
|
- getdownloadExcel(pkeyId)
|
|
|
- }
|
|
|
+ // if (isStatus.value === 3) {
|
|
|
+ // window?.$messageBox?.alert('是否选择把数据一起导出?', '下载模板', {
|
|
|
+ // showCancelButton: true,
|
|
|
+ // confirmButtonText: '是',
|
|
|
+ // cancelButtonText: '否',
|
|
|
+ // callback: (action) => {
|
|
|
+ // if (action === 'confirm') {
|
|
|
+ // console.log('数据')
|
|
|
+ // } else if ( action === 'cancel') {
|
|
|
+ // console.log('清表')
|
|
|
+ // getdownloadExcel(pkeyId)
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // console.log('清表')
|
|
|
+ // getdownloadExcel(pkeyId)
|
|
|
+ // }
|
|
|
+ getdownloadExcel(pkeyId)
|
|
|
}
|
|
|
// 暴露出去
|
|
|
defineExpose({
|