|
@@ -49,31 +49,17 @@
|
|
|
<el-date-picker v-model="createParticipation.createTime" style="width:20%;margin-right:5px;" type="datetime" placeholder="开始日期" />-
|
|
|
<el-date-picker v-model="createParticipation.modifyTime" style="width:20%;margin-right:5px;" type="datetime" placeholder="结束日期" />
|
|
|
创建人 <el-input v-model="createParticipation.creator" placeholder="创建人" clearable style="width: 20%;" class="filter-item" />
|
|
|
- <input
|
|
|
- id="imFile"
|
|
|
- type="file"
|
|
|
- style="display: none"
|
|
|
- accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
|
|
|
- @change="importFile(this)"
|
|
|
- >
|
|
|
- <a id="downlink" />
|
|
|
- <el-button id="upload" type="primary" style="margin-left:6%;" @click="uploadFile()">导入</el-button>
|
|
|
+ <input id="imFile" ref="imFile" type="file" style="display: none" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" @change="importFile(this)">
|
|
|
+ <el-button type="primary" style="margin-left:6%;" @click="uploadFile()">导入</el-button>
|
|
|
<el-button type="primary" @click="createGetShow">新增</el-button>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-header>
|
|
|
<el-main>
|
|
|
- <!--错误信息提示-->
|
|
|
- <el-dialog v-model="errorDialog" title="提示" size="tiny">
|
|
|
- <span>{{ errorMsg }}</span>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="errorDialog=false">确认</el-button>
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
<el-table :data="gridData" fit height="570vh" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
- <el-table-column prop="id" label="ID" width="40px" align="center">
|
|
|
+ <el-table-column prop="id" label="ID" width="60px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ scope.row.id }}</span>
|
|
|
</template>
|
|
@@ -81,8 +67,8 @@
|
|
|
<el-table-column prop="caseName" label="用例名" width="150" align="center" />
|
|
|
<el-table-column prop="expectedResult" label="期望结果" width="150" align="center" />
|
|
|
<el-table-column prop="casePriorityName" label="用例优先级" width="80" align="center" />
|
|
|
- <el-table-column prop="creatorName" label="创建人" width="120" align="center" />
|
|
|
- <el-table-column prop="modifierName" label="修改人" width="120" align="center" />
|
|
|
+ <el-table-column prop="creatorName" label="创建人" width="100" align="center" />
|
|
|
+ <el-table-column prop="modifierName" label="修改人" width="100" align="center" />
|
|
|
<el-table-column prop="createTime" label="创建时间" width="200" align="center" />
|
|
|
<el-table-column prop="address" label="操作" min-width="220px" align="center" fixed="right">
|
|
|
<template slot-scope="scope">
|
|
@@ -237,10 +223,9 @@ export default {
|
|
|
data1: [],
|
|
|
tableData: [],
|
|
|
excelData: [],
|
|
|
- imFile: '', // 导入文件el
|
|
|
- outFile: '', // 导出文件el
|
|
|
- errorDialog: false, // 错误信息弹窗
|
|
|
- errorMsg: '' // 错误信息内容
|
|
|
+ imFile: '',
|
|
|
+ failNum: '',
|
|
|
+ successNum: ''
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -249,7 +234,6 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
this.imFile = document.getElementById('imFile')
|
|
|
- this.outFile = document.getElementById('downlink')
|
|
|
},
|
|
|
methods: {
|
|
|
AllQueryFolderData() {
|
|
@@ -310,6 +294,7 @@ export default {
|
|
|
if (vel !== '' && e === '新增') {
|
|
|
this.caseData = vel
|
|
|
this.caseData.creator = this.userInformation
|
|
|
+ this.caseData.creatorName = this.userNames
|
|
|
this.caseData.modifier = this.userInformation
|
|
|
this.caseData.pageSize = 5
|
|
|
this.caseData.curIndex = 0
|
|
@@ -379,10 +364,14 @@ export default {
|
|
|
modifier: this.userInformation
|
|
|
}
|
|
|
createFolderData(this.formData).then(res => {
|
|
|
- this.centerDialogVisible = false
|
|
|
- this.successFun()
|
|
|
- this.data1 = []
|
|
|
- this.AllQueryFolderData()
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.centerDialogVisible = false
|
|
|
+ this.successFun()
|
|
|
+ this.data1 = []
|
|
|
+ this.AllQueryFolderData()
|
|
|
+ } else {
|
|
|
+ this.errorFun(res.msg)
|
|
|
+ }
|
|
|
})
|
|
|
} else {
|
|
|
this.errorFun('目录名称不能为空')
|
|
@@ -447,7 +436,6 @@ export default {
|
|
|
id: this.codeId,
|
|
|
modifier: this.userInformation
|
|
|
}
|
|
|
- // this.userData = { id: '', ename: this.userInformation, name: this.userNames }
|
|
|
deleteFolderData(this.formData).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message({ type: 'success', message: '已删除' })
|
|
@@ -479,8 +467,6 @@ export default {
|
|
|
this.data1 = []
|
|
|
this.AllQueryFolderData()
|
|
|
this.createParticipation.caseFolderId = this.startId
|
|
|
- // this.createParticipation.pageSize = this.pageSize
|
|
|
- // this.createParticipation.curIndex = this.curIndex
|
|
|
queryCasesData(this.createParticipation).then(res => {
|
|
|
this.gridData = res.data
|
|
|
})
|
|
@@ -515,7 +501,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
importFile() { // 导入excel
|
|
|
- const obj = this.imFile
|
|
|
+ var obj = this.imFile
|
|
|
if (!obj.files) {
|
|
|
return
|
|
|
}
|
|
@@ -530,82 +516,27 @@ export default {
|
|
|
}
|
|
|
formData.append('caseInfo', JSON.stringify(caseInfo))
|
|
|
const config = {
|
|
|
- headers: {
|
|
|
- 'Content-Type': 'multipart/form-data'
|
|
|
- // 'Content-Type': 'multipart/form-data;boundary = ' + new Date().getTime()
|
|
|
- }
|
|
|
+ headers: { 'Content-Type': 'multipart/form-data' }
|
|
|
}
|
|
|
- axios.post('http://10.179.24.176:8980/case/uploadCase', formData, config).then(function(res) {
|
|
|
- console.log(res.message)
|
|
|
- if (res.code === 200) {
|
|
|
- /* 这里做处理*/
|
|
|
+ axios.post('http://10.179.24.176:8980/case/uploadCase', formData, config).then(res => {
|
|
|
+ var code = res.data.data
|
|
|
+ this.successNum = code.successNum
|
|
|
+ this.failNum = code.failNum
|
|
|
+ console.log(this.failNum)
|
|
|
+ if (res.status === 200) {
|
|
|
+ if (this.failNum === 0) {
|
|
|
+ this.$notify({ title: 'Success', message: '上传成功', type: 'success', duration: 15000 })
|
|
|
+ } else {
|
|
|
+ this.haha = '上传成功' + this.successNum + '上传失败' + this.failNum
|
|
|
+ this.$notify({ title: 'Success', message: this.haha, type: 'success', duration: 15000 })
|
|
|
+ }
|
|
|
+ this.updateCaseListData()
|
|
|
+ this.$refs.imFile.value = null
|
|
|
+ } else {
|
|
|
+ this.$message({ type: 'success', message: '导入失败' })
|
|
|
}
|
|
|
})
|
|
|
- // console.log(formData.get('abc'))
|
|
|
- // var caseFrom = {
|
|
|
- // bizId: this.bizJson,
|
|
|
- // creator: this.userNames,
|
|
|
- // modifier: this.userNames,
|
|
|
- // caseFolderId: 11
|
|
|
- // }
|
|
|
- // caseUploadCaseData(formData).then(res => {
|
|
|
- // console.log(res)
|
|
|
- // })
|
|
|
- // var reader = new FileReader()
|
|
|
- // const $t = this
|
|
|
- // reader.onload = function(e) {
|
|
|
- // var data = e.target.result
|
|
|
- // if ($t.rABS) {
|
|
|
- // $t.wb = XLSX.read(btoa(this.fixdata(data)), { // 手动转化
|
|
|
- // type: 'base64'
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // $t.wb = XLSX.read(data, {
|
|
|
- // type: 'binary'
|
|
|
- // })
|
|
|
- // }
|
|
|
- // const json = XLSX.utils.sheet_to_json($t.wb.Sheets[$t.wb.SheetNames[0]])
|
|
|
- // $t.dealFile($t.analyzeData(json)) // analyzeData: 解析导入数据
|
|
|
- // }
|
|
|
- // if (this.rABS) {
|
|
|
- // reader.readAsArrayBuffer(f)
|
|
|
- // } else {
|
|
|
- // reader.readAsBinaryString(f)
|
|
|
- // }
|
|
|
- // },
|
|
|
- // analyzeData: function(data) { // 此处可以解析导入数据
|
|
|
- // return data
|
|
|
- // },
|
|
|
- // dealFile: function(data) { // 处理导入的数据
|
|
|
- // this.imFile.value = ''
|
|
|
- // if (data.length <= 0) {
|
|
|
- // this.errorDialog = true
|
|
|
- // this.errorMsg = '请导入正确信息'
|
|
|
- // } else {
|
|
|
- // this.excelData = data
|
|
|
- // caseUploadCaseData(this.excelData).then(res => {
|
|
|
- // console.log(res)
|
|
|
- // })
|
|
|
- // }
|
|
|
},
|
|
|
- // s2ab: function(s) { // 字符串转字符流
|
|
|
- // var buf = new ArrayBuffer(s.length)
|
|
|
- // var view = new Uint8Array(buf)
|
|
|
- // for (var i = 0; i !== s.length; ++i) {
|
|
|
- // view[i] = s.charCodeAt(i) & 0xFF
|
|
|
- // }
|
|
|
- // return buf
|
|
|
- // },
|
|
|
- // getCharCol: function(n) { // 将指定的自然数转换为26进制表示。映射关系:[0-25] -> [A-Z]。
|
|
|
- // let s = ''
|
|
|
- // let m = 0
|
|
|
- // while (n > 0) {
|
|
|
- // m = n % 26 + 1
|
|
|
- // s = String.fromCharCode(m + 64) + s
|
|
|
- // n = (n - m) / 26
|
|
|
- // }
|
|
|
- // return s
|
|
|
- // },
|
|
|
fixdata: function(data) { // 文件流转BinaryString
|
|
|
var o = ''
|
|
|
var l = 0
|
|
@@ -617,9 +548,22 @@ export default {
|
|
|
return o
|
|
|
},
|
|
|
uploadFile() { // 按钮导入
|
|
|
- this.imFile.click()
|
|
|
+ if (this.startId === '') {
|
|
|
+ this.$notify({ title: '提示', message: '请选择目录', duration: 2000 })
|
|
|
+ } else {
|
|
|
+ console.log(this.imFile)
|
|
|
+ this.$refs.imFile.click()
|
|
|
+ // this.imFile = document.getElementById('imFile')
|
|
|
+ // this.imFile.click()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateCaseListData() {
|
|
|
+ this.createParticipation.caseFolderId = this.startId
|
|
|
+ queryCasesData(this.createParticipation).then(res => {
|
|
|
+ this.gridData = res.data
|
|
|
+ this.successFun()
|
|
|
+ })
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
</script>
|