|
@@ -122,64 +122,86 @@
|
|
|
<!-- 上传、删除、下载操作栏 -->
|
|
|
<div
|
|
|
class="rightHeader"
|
|
|
- v-show="from.checkd&&from.fileUrl"
|
|
|
+ v-show="from.checkd"
|
|
|
>
|
|
|
- <div class="excelname">
|
|
|
- <div>{{from.extension}}</div>
|
|
|
- <i
|
|
|
- class="el-icon-success marleft10"
|
|
|
- style="color: rgb(0, 168, 112);"
|
|
|
- ></i>
|
|
|
- </div>
|
|
|
- <el-upload
|
|
|
- class="marleft10"
|
|
|
- :auto-upload="false"
|
|
|
- :show-file-list="false"
|
|
|
- action="#"
|
|
|
- :limit="1"
|
|
|
- :file-list='fileList'
|
|
|
- accept=".xls,.xlsx"
|
|
|
- :on-change="uploadChange"
|
|
|
- ref="file1"
|
|
|
- >
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- size="mini"
|
|
|
- >重新上传</el-button>
|
|
|
- </el-upload>
|
|
|
- <el-link
|
|
|
- class="marleft10 colorblue"
|
|
|
- @click="delectExcelMS"
|
|
|
- >删除</el-link>
|
|
|
- <el-link
|
|
|
- underline
|
|
|
- class="marleft10 colorblue"
|
|
|
- style="text-decoration:underline;"
|
|
|
- @click="downloadExcel()"
|
|
|
- >下载EXCEL</el-link>
|
|
|
-
|
|
|
+ <template v-if="from.fileUrl">
|
|
|
+ <div class="excelname">
|
|
|
+ <div>{{from.extension}}</div>
|
|
|
+ <i
|
|
|
+ class="el-icon-success marleft10"
|
|
|
+ style="color: rgb(0, 168, 112);"
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
+ <el-upload
|
|
|
+ class="marleft10"
|
|
|
+ :auto-upload="false"
|
|
|
+ :show-file-list="false"
|
|
|
+ action="#"
|
|
|
+ :limit="1"
|
|
|
+ :file-list='fileList'
|
|
|
+ accept=".xls,.xlsx"
|
|
|
+ :on-change="uploadChange"
|
|
|
+ ref="file1"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ >重新上传</el-button>
|
|
|
+ </el-upload>
|
|
|
+ <el-link
|
|
|
+ class="marleft10 colorblue"
|
|
|
+ @click="delectExcelMS"
|
|
|
+ >删除</el-link>
|
|
|
+ <el-link
|
|
|
+ underline
|
|
|
+ class="marleft10 colorblue"
|
|
|
+ style="text-decoration:underline;"
|
|
|
+ @click="downloadExcel()"
|
|
|
+ >下载EXCEL</el-link>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-upload
|
|
|
+ :auto-upload="false"
|
|
|
+ :show-file-list="false"
|
|
|
+ action="#"
|
|
|
+ :limit="1"
|
|
|
+ :file-list='fileList'
|
|
|
+ accept=".xls,.xlsx"
|
|
|
+ :on-change="uploadChange"
|
|
|
+ ref="file2"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ >上传 excel</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </template>
|
|
|
|
|
|
+ <div style="margin-left:50px;" class="flex">
|
|
|
+ <div class="excelname mg-r-10" v-if="from.import">
|
|
|
+ <div>{{from.import.name}}</div>
|
|
|
+ <i
|
|
|
+ class="el-icon-success marleft10"
|
|
|
+ style="color: rgb(0, 168, 112);"
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
+ <el-upload
|
|
|
+ :auto-upload="false"
|
|
|
+ :show-file-list="false"
|
|
|
+ action="#"
|
|
|
+ :limit="1"
|
|
|
+ accept=".xls,.xlsx"
|
|
|
+ :on-change="uploadcoverfileExcel"
|
|
|
+ ref="file3"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ >{{from.import?'重新上传导入模板':'上传导入模板'}}</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="rightHeader"
|
|
|
- v-show="from.checkd&&!from.fileUrl"
|
|
|
- >
|
|
|
- <el-upload
|
|
|
- :auto-upload="false"
|
|
|
- :show-file-list="false"
|
|
|
- action="#"
|
|
|
- :limit="1"
|
|
|
- :file-list='fileList'
|
|
|
- accept=".xls,.xlsx"
|
|
|
- :on-change="uploadChange"
|
|
|
- ref="file2"
|
|
|
- >
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- size="mini"
|
|
|
- >上传 excel</el-button>
|
|
|
- </el-upload>
|
|
|
- </div>
|
|
|
+
|
|
|
<el-empty
|
|
|
style="height:80%;"
|
|
|
v-show="!from.checkd"
|
|
@@ -335,7 +357,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { detailExcel, excelType, tabLazytree, getWbsTypeList, wbstree, selectByNodeTable, Excelmodify, uploadExcel, deleteExcelshu, deleteExcel ,tabLazytreeAll} from '@/api/exctab/excelmodel'
|
|
|
+import { detailExcel, excelType, tabLazytree, getWbsTypeList, wbstree, selectByNodeTable, Excelmodify, uploadExcel, deleteExcelshu, deleteExcel ,tabLazytreeAll,
|
|
|
+ uploadcoverfileExcel} from '@/api/exctab/excelmodel'
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
@@ -364,6 +387,8 @@ export default {
|
|
|
id: '',//清表树ID
|
|
|
extension: '', //文件名称
|
|
|
fileUrl: '',//文件路径
|
|
|
+
|
|
|
+ import:null,
|
|
|
},
|
|
|
fileList: [],//选中的文件
|
|
|
excelSrc: '',//
|
|
@@ -577,9 +602,13 @@ export default {
|
|
|
} catch (error) {
|
|
|
loading.close();
|
|
|
}
|
|
|
-
|
|
|
- this.$refs.file1.clearFiles();
|
|
|
- this.$refs.file2.clearFiles();
|
|
|
+
|
|
|
+ if(this.$refs.file1){
|
|
|
+ this.$refs.file1.clearFiles();
|
|
|
+ }
|
|
|
+ if(this.$refs.file2){
|
|
|
+ this.$refs.file2.clearFiles();
|
|
|
+ }
|
|
|
},
|
|
|
delectExcelMS () {//删除excel表点击事件、
|
|
|
let _that = this
|
|
@@ -844,7 +873,35 @@ export default {
|
|
|
filterNode(value, data) {
|
|
|
if (!value) return true;
|
|
|
return data.name.indexOf(value) !== -1;
|
|
|
+ },
|
|
|
+
|
|
|
+ uploadcoverfileExcel(file){
|
|
|
+ let formData = new FormData()
|
|
|
+ formData.append('file', file.raw)
|
|
|
+ formData.append('nodeId', this.from.id)
|
|
|
+ //console.log(file.raw)
|
|
|
+
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: 'Loading',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ });
|
|
|
+
|
|
|
+ uploadcoverfileExcel(formData).then(() => {
|
|
|
+ this.from.import=file.raw;
|
|
|
+ this.$message({
|
|
|
+ message: '上传文件成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ loading.close();
|
|
|
+ }).catch(() => {
|
|
|
+ loading.close();
|
|
|
+ });
|
|
|
+
|
|
|
+ this.$refs.file3.clearFiles();
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
created () {
|
|
|
this.excelType()//清表类型
|