|
@@ -233,8 +233,8 @@
|
|
|
</template>
|
|
|
|
|
|
<div style="margin-left:50px;" class="flex">
|
|
|
- <div class="excelname mg-r-10" v-if="from.extension">
|
|
|
- <div>{{from.extension}}</div>
|
|
|
+ <div class="excelname mg-r-10" v-if="from.templateExtension">
|
|
|
+ <div>{{from.templateExtension}}</div>
|
|
|
<i
|
|
|
class="el-icon-success marleft10"
|
|
|
style="color: rgb(0, 168, 112);"
|
|
@@ -252,8 +252,20 @@
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
size="mini"
|
|
|
- >{{from.extension?'重新上传导入模板':'上传导入模板'}}</el-button>
|
|
|
+ >{{from.templateExtension?'重新上传导入模板':'上传导入模板'}}</el-button>
|
|
|
</el-upload>
|
|
|
+ <el-link
|
|
|
+ v-if="from.templateExtension"
|
|
|
+ class="marleft10 colorblue"
|
|
|
+ @click="delectExcelMSModel"
|
|
|
+ >删除</el-link>
|
|
|
+ <el-link
|
|
|
+ v-if="from.templateExtension"
|
|
|
+ underline
|
|
|
+ class="marleft10 colorblue"
|
|
|
+ style="text-decoration:underline;"
|
|
|
+ @click="downloadExcelModel()"
|
|
|
+ >下载模板</el-link>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -477,8 +489,8 @@
|
|
|
|
|
|
<script>
|
|
|
import {mapGetters} from "vuex";
|
|
|
-import { detailExcel, excelType, tabLazytree, getWbsTypeList, wbstree, selectByNodeTable, Excelmodify, uploadExcel, deleteExcelshu, deleteExcel ,tabLazytreeAll,
|
|
|
- uploadcoverfileExcel,downExcelFile,exctabSort} from '@/api/exctab/excelmodel';
|
|
|
+import { detailExcel, excelType, tabLazytree, getWbsTypeList, wbstree, selectByNodeTable, Excelmodify, uploadExcel, deleteExcelshu, deleteExcel ,deleteExcelmodel,tabLazytreeAll,
|
|
|
+ uploadcoverfileExcel,downExcelFile,downExcelFileModel,exctabSort} from '@/api/exctab/excelmodel';
|
|
|
import ManualSorting from '@/components/WbsTree/ManualSorting'
|
|
|
import VabOnlyOffice from '@/components/online-office/index'
|
|
|
import { log } from '@antv/g2plot/lib/utils';
|
|
@@ -722,6 +734,7 @@ export default {
|
|
|
if (res.code === 200) {
|
|
|
this.from.id = res.data.id
|
|
|
this.from.extension = res.data.extension //文件名称
|
|
|
+ this.from.templateExtension=res.data.templateExtension
|
|
|
this.from.name=res.data.name
|
|
|
this.from.fileUrl = res.data.fileUrl //文件路径
|
|
|
let routeUrl = res.data.fileUrl
|
|
@@ -916,6 +929,38 @@ export default {
|
|
|
URL.revokeObjectURL(objectUrl); // 释放内存
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ delectExcelMSModel () {//删除excel表点击事件、
|
|
|
+ let _that = this
|
|
|
+ this.$confirm('确认删除该文件?', '', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ deleteExcelmodel({ id: _that.from.id, fileUrl: '' }).then((res)=>{
|
|
|
+ if(res.data.code==200){
|
|
|
+ _that.from.templateExtension=''
|
|
|
+ this.$forceUpdate()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ downloadExcelModel () {//下载excel表
|
|
|
+ //this.downFile(this.from.fileUrl,"123456.xlsx");
|
|
|
+ //window.open(this.from.fileUrl,'namexxx')
|
|
|
+ const link = document.createElement('a')
|
|
|
+ downExcelFileModel(this.from.id).then((res)=>{
|
|
|
+ // 创建Blob对象,设置文件类型
|
|
|
+ let blob = new Blob([res.data], {type: "application/vnd.ms-excel"})
|
|
|
+ let objectUrl = URL.createObjectURL(blob) // 创建URL
|
|
|
+ link.href = objectUrl
|
|
|
+ link.download = this.from.extension // 自定义文件名
|
|
|
+ link.click() // 下载文件
|
|
|
+ URL.revokeObjectURL(objectUrl); // 释放内存
|
|
|
+ })
|
|
|
+ },
|
|
|
//#endregion
|
|
|
|
|
|
//#region 外层左侧事件
|
|
@@ -1179,9 +1224,12 @@ export default {
|
|
|
},
|
|
|
|
|
|
uploadcoverfileExcel(file){
|
|
|
+ console.log('上传导入模板');
|
|
|
+ this.from.templateExtension=false
|
|
|
let formData = new FormData()
|
|
|
formData.append('file', file.raw)
|
|
|
formData.append('nodeId', this.from.id)
|
|
|
+ this.from.templateExtension=file.raw.name
|
|
|
// console.log(file.raw)
|
|
|
|
|
|
const loading = this.$loading({
|
|
@@ -1192,18 +1240,22 @@ export default {
|
|
|
});
|
|
|
|
|
|
uploadcoverfileExcel(formData).then(() => {
|
|
|
- this.from.import=file.raw;
|
|
|
- this.from.extension=file.raw.name
|
|
|
this.$message({
|
|
|
message: '上传文件成功',
|
|
|
type: 'success'
|
|
|
})
|
|
|
+ // this.detailExcel(this.from.id)
|
|
|
loading.close();
|
|
|
}).catch(() => {
|
|
|
loading.close();
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
this.$refs.file3.clearFiles();
|
|
|
+ this.$forceUpdate()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
//上传
|
|
|
uploadMoudle(){
|