|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div id="init-window" style="position:relative; min-height:95vh; background:#F2F3F6;">
|
|
|
<router-view />
|
|
|
- <div v-show="div1" style="position: absolute;width: 100%;">
|
|
|
+ <div style="position: absolute;width: 100%;">
|
|
|
<div style="background:#F2F3F6;">
|
|
|
<el-container>
|
|
|
<el-aside width="17%" style=" background: #FFF;margin: 1% 0 1% 1%; border-radius:8px;">
|
|
@@ -83,9 +83,9 @@
|
|
|
</el-row>
|
|
|
</el-header>
|
|
|
<el-main style="background:#ffffff; width:98%;margin:0% 1% 1% 1%; font-size:14px;border-radius:8px;">
|
|
|
- <el-button type="primary" style="margin-left:1%;width:10%;" @click="uploadFile()">导入</el-button>
|
|
|
+ <el-button type="primary" style="margin-left:1%;" @click="uploadFile()">导入</el-button>
|
|
|
<el-tooltip class="item" effect="light" content="导出勾选项,没有勾选将导出excel模版" placement="top">
|
|
|
- <el-button style="margin-left:2%;width:10%;" @click="exportExcel">导出</el-button>
|
|
|
+ <el-button style="margin-left:2%;" @click="exportExcel">导出</el-button>
|
|
|
</el-tooltip>
|
|
|
<!-- 主页table -->
|
|
|
<el-table :data="gridData" size="mini" :header-cell-style="{ background: '#F0F2F4', color: '#333B4A' }" style="width: 100%; font-size:13px;margin-top:1%;" border @select-all="clickAllData" @selection-change="handleSelectionChange">
|
|
@@ -134,10 +134,10 @@
|
|
|
<script>
|
|
|
import { createFolderData, queryAllFolderData, queryCasesData, deleteFolderData, deleteCaseData, updateFolderData, caseUpdateFolderName } from '@/api/caseProject.js'
|
|
|
import { mockUrl } from '@/apiConfig/api'
|
|
|
-import FileSaver from 'file-saver'
|
|
|
+// import FileSaver from 'file-saver'
|
|
|
import axios from 'axios'
|
|
|
-import XLSX from 'xlsx'
|
|
|
-import Utils from '../../util.js'
|
|
|
+// import XLSX from 'xlsx'
|
|
|
+// import Utils from '../../util.js'
|
|
|
|
|
|
export default {
|
|
|
name: 'UseCasePage',
|
|
@@ -145,7 +145,6 @@ export default {
|
|
|
return {
|
|
|
key_arr: [],
|
|
|
fileList: [],
|
|
|
- div1: true,
|
|
|
id: '',
|
|
|
label: '',
|
|
|
node_Name: {},
|
|
@@ -184,10 +183,10 @@ export default {
|
|
|
this.AllQueryFolderData(localStorage.getItem('key'))
|
|
|
},
|
|
|
mounted() {
|
|
|
- var that = this
|
|
|
- Utils.$on('demo', function(msg) {
|
|
|
- that.AllQueryFolderData(msg)
|
|
|
- })
|
|
|
+ // var that = this
|
|
|
+ // Utils.$on('demo', function(msg) {
|
|
|
+ // that.AllQueryFolderData(msg)
|
|
|
+ // })
|
|
|
this.imFile = document.getElementById('imFile')
|
|
|
this.initWindow()
|
|
|
// this.AllQueryFolderData(localStorage.getItem('key'))
|
|
@@ -279,9 +278,9 @@ export default {
|
|
|
modifier: this.userInformation
|
|
|
}
|
|
|
createFolderData(this.formData).then(res => {
|
|
|
+ console.log(res.data)
|
|
|
if (res.code === 200) {
|
|
|
- var id = 1
|
|
|
- const newChild = { id: id++, label: '新建子节点', children: [] }
|
|
|
+ const newChild = { id: res.data, label: '新建子节点', children: [] }
|
|
|
if (!data.children) {
|
|
|
this.$set(data, 'children', [])
|
|
|
}
|
|
@@ -427,7 +426,6 @@ export default {
|
|
|
this.$router.push({ path: '/Platform/useCasePage/queryUse', query: { id: ele.id, caseFolderId: ele.caseFolderId }})
|
|
|
break
|
|
|
case 2: // 编辑
|
|
|
- // this.div1 = false
|
|
|
this.$router.push({ path: '/Platform/useCasePage/createUse', query: { id: ele.id, caseFolderId: ele.caseFolderId }})
|
|
|
break
|
|
|
case 3: // 新增
|
|
@@ -437,7 +435,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
handleSelectionChange(val) {
|
|
|
- this.tableData = val
|
|
|
+ this.tableData = []
|
|
|
+ for (var e of val) {
|
|
|
+ this.tableData.push(e.id)
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// nav
|
|
@@ -550,15 +551,58 @@ export default {
|
|
|
|
|
|
// 导出
|
|
|
exportExcel() {
|
|
|
- if (this.startId === '') {
|
|
|
- this.$message({ message: '提示,👈请选择目录', type: 'success', duration: 1000, offset: 150 })
|
|
|
+ var case_from = {
|
|
|
+ accessory: '/Users/didi/Desktop',
|
|
|
+ caseFolderId: this.startId,
|
|
|
+ caseIds: this.tableData
|
|
|
+ }
|
|
|
+ axios({
|
|
|
+ method: 'post',
|
|
|
+ url: 'http://10.179.24.176:8980/case/downloadCase', // 请求地址
|
|
|
+ data: case_from, // 参数
|
|
|
+ responseType: 'blob' // 表明返回服务器返回的数据类型
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ const content = res
|
|
|
+ const blob = new Blob([content])
|
|
|
+ if ('download' in document.createElement('a')) { // 非IE下载
|
|
|
+ const elink = document.createElement('a')
|
|
|
+ elink.download = '导出信息.xls'
|
|
|
+ elink.style.display = 'none'
|
|
|
+ elink.href = URL.createObjectURL(blob)
|
|
|
+ document.body.appendChild(elink)
|
|
|
+ elink.click()
|
|
|
+ URL.revokeObjectURL(elink.href) // 释放URL 对象
|
|
|
+ document.body.removeChild(elink)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // if (this.startId === '') {
|
|
|
+ // this.$message({ message: '提示,👈请选择目录', type: 'success', duration: 1000, offset: 150 })
|
|
|
+ // } else {
|
|
|
+ // var wb = XLSX.utils.table_to_book(document.querySelector('#out-table'))
|
|
|
+ // var wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
|
|
|
+ // try {
|
|
|
+ // FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), 'sheetjs.xlsx')
|
|
|
+ // } catch (e) { if (typeof console !== 'undefined') console.log(e, wbout) }
|
|
|
+ // return wbout
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ downLoadXls(data, filename) {
|
|
|
+ // var blob = new Blob([data], {type: 'application/vnd.ms-excel'})接收的是blob,若接收的是文件流,需要转化一下
|
|
|
+ if (typeof window.chrome !== 'undefined') {
|
|
|
+ // Chrome version
|
|
|
+ var link = document.createElement('a')
|
|
|
+ link.href = window.URL.createObjectURL(data)
|
|
|
+ link.download = filename
|
|
|
+ link.click()
|
|
|
+ } else if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
|
|
+ // IE version
|
|
|
+ var blob = new Blob([data], { type: 'application/force-download' })
|
|
|
+ window.navigator.msSaveBlob(blob, filename)
|
|
|
} else {
|
|
|
- var wb = XLSX.utils.table_to_book(document.querySelector('#out-table'))
|
|
|
- var wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
|
|
|
- try {
|
|
|
- FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), 'sheetjs.xlsx')
|
|
|
- } catch (e) { if (typeof console !== 'undefined') console.log(e, wbout) }
|
|
|
- return wbout
|
|
|
+ // Firefox version
|
|
|
+ var file = new File([data], filename, { type: 'application/force-download' })
|
|
|
+ window.open(URL.createObjectURL(file))
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -623,8 +667,10 @@ export default {
|
|
|
|
|
|
updateCaseListData() {
|
|
|
this.createParticipation.caseFolderId = this.startId
|
|
|
+ this.createParticipation.pageSize = this.pageSize
|
|
|
+ this.createParticipation.curIndex = this.curIndex
|
|
|
queryCasesData(this.createParticipation).then(res => {
|
|
|
- this.gridData = [res.data]
|
|
|
+ this.gridData = res.data.list
|
|
|
this.$message({ type: res.msg, message: res.msg, duration: 1000 })
|
|
|
})
|
|
|
}
|
|
@@ -654,4 +700,17 @@ export default {
|
|
|
background: #F9F9FA !important;
|
|
|
border-color: #F9F9FA !important;
|
|
|
}
|
|
|
+ .nav_Input .el-tree-node__children .custom-tree-node{
|
|
|
+ color: #6F7C93;
|
|
|
+ }
|
|
|
+ .nav_Input .el-tree-node__content {
|
|
|
+ color: #333B4A;
|
|
|
+ }
|
|
|
+ .nav_Input .el-tree-node__content .el-tree-node__expand-icon{
|
|
|
+ color: #333B4A;
|
|
|
+ }
|
|
|
+ .nav_Input .el-tree-node__expand-icon.is-leaf{
|
|
|
+ color: transparent !important;
|
|
|
+ cursor: default !important
|
|
|
+ }
|
|
|
</style>
|