|
@@ -79,6 +79,7 @@
|
|
|
需求名称<el-input v-model="createParticipation.taskName" placeholder="创建人" clearable style="width: 50%;margin-left:2%;" class="filter-item" />
|
|
|
</div>
|
|
|
<input id="imFile" ref="imFile" type="file" style="display: none" @change="importFile(this)">
|
|
|
+ <input id="im_File" ref="im_File" type="file" style="display: none" @change="import_File(this)">
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-header>
|
|
@@ -115,6 +116,7 @@
|
|
|
</el-main>
|
|
|
<!-- xmind -->
|
|
|
<el-main style="background:#ffffff; width:98%;margin:0% 1% 1% 1%; font-size:14px;border-radius:8px;">
|
|
|
+ <el-button type="primary" size="mini" style="margin-left:1%;" @click="upload_File()">导入</el-button>
|
|
|
<el-table :data="grid_xmind" 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">
|
|
|
<el-table-column type="selection" min-width="50" align="center" @change="clickAllData(gridData)" />
|
|
|
<el-table-column prop="name" label="文件名" min-width="80" align="center">
|
|
@@ -139,7 +141,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { createFolderData, queryAllFolderData, queryCasesData, deleteFolderData, deleteCaseData, updateFolderData, caseUpdateFolderName, updateXmindUrl } from '@/api/caseProject.js'
|
|
|
+import { createFolderData, queryAllFolderData, queryCasesData, deleteFolderData, deleteCaseData, updateFolderData, caseUpdateFolderName, updateXmindUrl, uploadCaseByXmind } from '@/api/caseProject.js'
|
|
|
import { mockUrl } from '@/apiConfig/api'
|
|
|
// import FileSaver from 'file-saver'
|
|
|
import axios from 'axios'
|
|
@@ -178,6 +180,7 @@ export default {
|
|
|
data1: [],
|
|
|
tableData: [],
|
|
|
imFile: '',
|
|
|
+ im_File: '',
|
|
|
failNum: '',
|
|
|
o_number: '',
|
|
|
successNum: '',
|
|
@@ -196,6 +199,7 @@ export default {
|
|
|
// that.AllQueryFolderData(msg)
|
|
|
// })
|
|
|
this.imFile = document.getElementById('imFile')
|
|
|
+ this.im_File = document.getElementById('im_File')
|
|
|
this.initWindow()
|
|
|
// this.AllQueryFolderData(localStorage.getItem('key'))
|
|
|
},
|
|
@@ -588,6 +592,37 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ // 导入xmind
|
|
|
+ import_File() {
|
|
|
+ var obj = this.imFile
|
|
|
+ if (!obj.files) { return }
|
|
|
+ var f = obj.files[0]
|
|
|
+ console.log(f)
|
|
|
+ var a_name = f.name.split('.')
|
|
|
+ console.log(a_name[1])
|
|
|
+
|
|
|
+ if (a_name[1] === 'xmind') {
|
|
|
+ var formData_s = new FormData()
|
|
|
+ formData_s.append('file', f)
|
|
|
+ axios.post('http://star.xiaojukeji.com/upload/img.node', formData_s, { headers: { 'Content-Type': 'application/json; charset=UTF-8' }}).then(res => {
|
|
|
+ console.error(res.url)
|
|
|
+ this.grid_xmind.push({ 'name': 'f.name', 'url': 'http:' + 'res.url' })
|
|
|
+ var xmind_code = {
|
|
|
+ id: this.startId,
|
|
|
+ xmindUrl: JSON.stringify(this.grid_xmind),
|
|
|
+ modifier: this.userInformation
|
|
|
+ }
|
|
|
+ updateXmindUrl(xmind_code).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message({ type: 'success', message: '导入成功' })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message({ type: 'error', message: '导入失败,不支持文件类型(只支持xmind)' })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
// 导入excel
|
|
|
importFile() {
|
|
|
var obj = this.imFile
|
|
@@ -601,8 +636,8 @@ export default {
|
|
|
formData.append('file', f)
|
|
|
var caseInfo = {
|
|
|
bizId: this.bizJson,
|
|
|
- creator: this.userNames,
|
|
|
- modifier: this.userNames,
|
|
|
+ creator: this.userInformation,
|
|
|
+ modifier: this.userInformation,
|
|
|
caseFolderId: this.startId
|
|
|
}
|
|
|
formData.append('caseInfo', JSON.stringify(caseInfo))
|
|
@@ -627,22 +662,21 @@ export default {
|
|
|
if (a_name[1] === 'xmind') {
|
|
|
var formData_s = new FormData()
|
|
|
formData_s.append('file', f)
|
|
|
- axios.post('http://star.xiaojukeji.com/upload/img.node', formData_s, { headers: { 'Content-Type': 'application/json; charset=UTF-8' }}).then(res => {
|
|
|
- console.error(res.url)
|
|
|
- this.grid_xmind.push({ 'name': f.name, 'url': 'http:' + res.url })
|
|
|
- var xmind_code = {
|
|
|
- id: this.startId,
|
|
|
- xmindUrl: JSON.stringify(this.grid_xmind),
|
|
|
- modifier: this.userInformation
|
|
|
+ var xmind_code = {
|
|
|
+ caseFolderId: this.startId,
|
|
|
+ bizId: this.bizJson,
|
|
|
+ creator: this.userInformation,
|
|
|
+ modifier: this.userInformation
|
|
|
+ }
|
|
|
+ formData_s.append('caseInfo', JSON.stringify(xmind_code))
|
|
|
+ uploadCaseByXmind(formData_s).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.updateCaseListData()
|
|
|
+ this.$message({ type: 'success', message: '导入成功' })
|
|
|
+ } else {
|
|
|
+ this.$message({ type: 'success', message: '导入失败' })
|
|
|
}
|
|
|
- updateXmindUrl(xmind_code).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.$message({ type: 'success', message: '导入成功' })
|
|
|
- }
|
|
|
- })
|
|
|
})
|
|
|
- } else {
|
|
|
- this.$message({ type: 'error', message: '导入失败,不支持文件类型(支持xmind,excel)' })
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -655,6 +689,14 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ upload_File() {
|
|
|
+ if (this.startId === '') {
|
|
|
+ this.$message({ message: '提示,👈请选择目录', type: 'success', duration: 1000, offset: 150 })
|
|
|
+ } else {
|
|
|
+ this.$refs.im_File.click()
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
updateCaseListData() {
|
|
|
this.createParticipation.caseFolderId = this.startId
|
|
|
this.createParticipation.pageSize = this.pageSize
|