|
@@ -93,13 +93,20 @@
|
|
<div class="table-tip-foot">
|
|
<div class="table-tip-foot">
|
|
<div class="tip-left-btn">
|
|
<div class="tip-left-btn">
|
|
<HcTooltip keys="wbs_import_table">
|
|
<HcTooltip keys="wbs_import_table">
|
|
- <div class="text-gray-400 dow-text">
|
|
|
|
|
|
+ <div class="text-main dow-text" @click="uploadFileClick(item)">
|
|
<HcIcon name="publish" ui="text-lg" />
|
|
<HcIcon name="publish" ui="text-lg" />
|
|
- <span class="ml-1">导入列表数据</span>
|
|
|
|
|
|
+ <span class="ml-1">导入表格数据</span>
|
|
</div>
|
|
</div>
|
|
</HcTooltip>
|
|
</HcTooltip>
|
|
|
|
+ <HcUploadFile
|
|
|
|
+ ref="dataHcUploadFileRef"
|
|
|
|
+ :params="{ pKeyId: checkItem.pKeyId }"
|
|
|
|
+ :options="UploadFileOptions"
|
|
|
|
+ multiple="false"
|
|
|
|
+ @success="HcUploadFileSuccess"
|
|
|
|
+ />
|
|
<HcTooltip keys="wbs_download_table">
|
|
<HcTooltip keys="wbs_download_table">
|
|
- <div class="text-main dow-text">
|
|
|
|
|
|
+ <div v-loading="downloadLoading" class="text-main dow-text" @click="downModal(item)">
|
|
<HcIcon name="file_download" ui="text-lg" />
|
|
<HcIcon name="file_download" ui="text-lg" />
|
|
<span class="ml-1">下载导入模板</span>
|
|
<span class="ml-1">下载导入模板</span>
|
|
</div>
|
|
</div>
|
|
@@ -228,9 +235,12 @@ import dataApi1 from '~api/tentative/parameter/container'
|
|
import dataApi2 from '~api/tentative/device/approach'
|
|
import dataApi2 from '~api/tentative/device/approach'
|
|
import { getClassList } from '~api/tentative'
|
|
import { getClassList } from '~api/tentative'
|
|
import notableform from '~src/assets/view/notableform.svg'
|
|
import notableform from '~src/assets/view/notableform.svg'
|
|
|
|
+import { getTokenHeader } from '~src/api/request/header'
|
|
import {
|
|
import {
|
|
|
|
+ arrIndex,
|
|
base64ToFile,
|
|
base64ToFile,
|
|
deepClone,
|
|
deepClone,
|
|
|
|
+ downloadBlob,
|
|
formValidate,
|
|
formValidate,
|
|
getArrValue,
|
|
getArrValue,
|
|
getObjVal,
|
|
getObjVal,
|
|
@@ -1421,7 +1431,60 @@ const getActiveKey = () => {
|
|
const setActiveKey = (key) => {
|
|
const setActiveKey = (key) => {
|
|
return ActiveKey.value = key
|
|
return ActiveKey.value = key
|
|
}
|
|
}
|
|
|
|
+//下载导入模板
|
|
|
|
+const downloadLoading = ref(false)
|
|
|
|
+const getdownloadExcel = async (pKeyId)=>{
|
|
|
|
+ downloadLoading.value = true
|
|
|
|
+ const { error, disposition, res } = await wbsApi.downloadExcel({ pKeyId: pKeyId })
|
|
|
|
+ //处理数据
|
|
|
|
+ downloadLoading.value = false
|
|
|
|
+ if (!error) {
|
|
|
|
+ if (disposition) {
|
|
|
|
+ downloadBlob(res, disposition)
|
|
|
|
+ } else {
|
|
|
|
+ window.$message?.error('数据异常')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+//下载模板
|
|
|
|
+const downModal = (item)=>{
|
|
|
|
+ const { pKeyId } = item
|
|
|
|
+ getdownloadExcel(pKeyId)
|
|
|
|
+}
|
|
|
|
+//导入表格数据
|
|
|
|
+//导入模板
|
|
|
|
+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)
|
|
|
|
+ if (resData) {
|
|
|
|
+ // refs?.setFormData(resData)
|
|
|
|
+ formData.value = resData
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dataHcUploadFileRef.value[0]?.setModalShow(false)
|
|
|
|
+
|
|
|
|
+}
|
|
// 暴露出去
|
|
// 暴露出去
|
|
defineExpose({
|
|
defineExpose({
|
|
setFormChart,
|
|
setFormChart,
|