|
@@ -25,58 +25,8 @@
|
|
|
</el-form>
|
|
|
</el-header>
|
|
|
<el-main style="background:#ffffff;height:auto; width:94%;margin: 0 3% 3% 3%; font-size:14px;border-radius:8px;">
|
|
|
- <!-- 编辑 -->
|
|
|
- <el-form v-show="form_Query" label-width="80px" :model="caseData" style="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04); margin-bottom:2%;">
|
|
|
- <el-row>
|
|
|
- <el-col :span="20" style="margin:2% 0 0 0; white-space:nowrap;">
|
|
|
- <el-form-item label="执行步骤">
|
|
|
- <el-input v-model="caseData.description" type="textarea" :rows="4" placeholder="请输入内容" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row>
|
|
|
- <el-col :span="22">
|
|
|
- <el-form-item label="预期结果">
|
|
|
- <el-input v-model="caseData.expectedResult" placeholder="请输入内容" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <div style="display:flex;">
|
|
|
- <el-row style="flex:1;">
|
|
|
- <el-col :span="22">
|
|
|
- <el-form-item label="附件">
|
|
|
- <el-upload class="upload-demo" drag action="http://star.xiaojukeji.com/upload/img.node" multiple :on-success="(response, file, fileList)=>{return constractSuccUpload(response, file, fileList )}" :on-progress="DisableButton">
|
|
|
- <i class="el-icon-plus avatar-uploader-icon"> 添加图片 </i>
|
|
|
- </el-upload>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row style="flex:1;">
|
|
|
- <el-col :span="20">
|
|
|
- <el-form-item label="备注">
|
|
|
- <el-input v-model="caseData.remark" type="textarea" :rows="8" placeholder="请输入内容" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
- <div v-show="btn_show" align="center" class="cla">
|
|
|
- <el-table v-show="btn_show" :data="uptataKey" fit style="width: 90%;">
|
|
|
- <el-table-column label="" min-width="150">
|
|
|
- <template slot-scope="scope">{{ scope.row.name }}</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="" min-width="300">
|
|
|
- <template slot-scope="scope"><a :href="scope.row.url" style="color:blue;">{{ scope.row.url }}</a></template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column fixed="right" label="" width="50" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button class="deleteSty" @click="deleteURL(scope.row)"> x </el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </div>
|
|
|
- </el-form>
|
|
|
<!-- 新增 -->
|
|
|
- <el-form v-for="(item, index) in data" v-show="form_created" :key="index" label-width="80px" :model="item" style="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04); margin-bottom:2%;">
|
|
|
+ <el-form v-for="(item, index) in data" :key="index" label-width="80px" :model="item" style="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04); margin-bottom:2%;">
|
|
|
<el-row>
|
|
|
<el-col :span="20" style="margin:2% 0 0 0; white-space:nowrap;">
|
|
|
<el-form-item label="执行步骤">
|
|
@@ -111,26 +61,10 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
- <div v-show="btn_show" align="center" class="cla">
|
|
|
- <el-table v-show="btn_show" :data="uptataKey" fit style="width: 90%;">
|
|
|
- <el-table-column label="" min-width="150">
|
|
|
- <template slot-scope="scope">{{ scope.row.name }}</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="" min-width="300">
|
|
|
- <template slot-scope="scope"><a :href="scope.row.url" style="color:blue;">{{ scope.row.url }}</a></template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column fixed="right" label="" width="50" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button class="deleteSty" @click="deleteURL(scope.row)"> x </el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </div>
|
|
|
</el-form>
|
|
|
- <!-- </div> -->
|
|
|
<el-row>
|
|
|
<el-col :span="22" style="text-align:right; ">
|
|
|
- <el-button :disabled="dis" type="primary" @click="caseCreateCase(caseData, titleName)">保 存</el-button>
|
|
|
+ <el-button :disabled="dis" type="primary" @click="caseCreateCase(caseData)">保 存</el-button>
|
|
|
<el-button style="margin:9% 0 0 4%;" @click="$router.go(-1)">取 消</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -141,7 +75,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { createFolderData, createCaseData, updateCaseData, queryCasesData } from '@/api/caseProject.js'
|
|
|
+import { createCaseData } from '@/api/caseProject.js'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -150,24 +84,16 @@ export default {
|
|
|
userNames: localStorage.getItem('username'),
|
|
|
bizJson: localStorage.getItem('key'),
|
|
|
startId: '',
|
|
|
- caseFolderId: '',
|
|
|
caseData: {},
|
|
|
- btn_show: false,
|
|
|
dis: false,
|
|
|
- form_Query: false,
|
|
|
- form_created: false,
|
|
|
id: '',
|
|
|
arry: [],
|
|
|
arr: [],
|
|
|
- tableList: [],
|
|
|
- titleName: '',
|
|
|
- uptataKey: [],
|
|
|
createFormData: {
|
|
|
caseCondition: [{ required: true, message: '前置条件不能为空', trigger: 'change' }],
|
|
|
api: [{ required: true, message: '对应接口不能为空', trigger: 'change' }],
|
|
|
casePriority: [{ required: true, message: '用例优先级不能为空', trigger: 'change' }]
|
|
|
},
|
|
|
- textarea: '',
|
|
|
priorityStrings: [{ name: 'p0', value: 0 }, { name: 'p1', value: 1 }, { name: 'p2', value: 2 }, { name: 'p3', value: 3 }]
|
|
|
}
|
|
|
},
|
|
@@ -175,74 +101,29 @@ export default {
|
|
|
this.initCode()
|
|
|
},
|
|
|
methods: {
|
|
|
- trademrakRegistSuccess(obj, res, file) {
|
|
|
- var obj_data = obj.data
|
|
|
- this.arr.push({ name: file.name, url: 'http:' + file.response.url })
|
|
|
- obj_data.accessory = JSON.stringify(this.arr)
|
|
|
- this.arry.push(obj_data)
|
|
|
- this.dis = false
|
|
|
- console.log(this.arry)
|
|
|
- },
|
|
|
+ // 初始化
|
|
|
initCode() {
|
|
|
- if (this.$route.query.data) { // 新增
|
|
|
- this.titleName = '新增'
|
|
|
- this.form_created = true
|
|
|
- this.btn_show = false
|
|
|
+ if (this.$route.query.data) {
|
|
|
this.startId = this.$route.query.data
|
|
|
if (this.$refs['caseData'] !== undefined) {
|
|
|
this.$refs['caseData'].resetFields()
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
|
|
|
- if (this.$route.query.id) { // 编辑
|
|
|
- this.titleName = '编辑'
|
|
|
- this.form_Query = true
|
|
|
- this.url = window.location.href // 获取url中"?"符后的字串
|
|
|
- this.id = this.url.split('?id=')
|
|
|
- this.startId = this.id[1]
|
|
|
- queryCasesData({ caseFolderId: this.id[1] }).then(res => {
|
|
|
- for (var el of res.data.list) {
|
|
|
- el.caseFolderId === Number(this.id[1]) ? this.caseData = el : ''
|
|
|
- if (this.caseData.accessory !== '') {
|
|
|
- this.btn_show = true
|
|
|
- var obj = JSON.parse(this.caseData.accessory.split('{}')[0])
|
|
|
- for (var a of obj) {
|
|
|
- this.uptataKey.push(a)
|
|
|
- }
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ // 图片上传成功的回调
|
|
|
+ trademrakRegistSuccess(obj, res, file) {
|
|
|
+ var obj_data = obj.data
|
|
|
+ this.arr.push({ name: file.name, url: 'http:' + file.response.url })
|
|
|
+ obj_data.accessory = JSON.stringify(this.arr)
|
|
|
+ this.arry.push(obj_data)
|
|
|
+ this.dis = false
|
|
|
},
|
|
|
|
|
|
+ // 上传成功可以提交
|
|
|
DisableButton() {
|
|
|
this.dis = true
|
|
|
},
|
|
|
- getCreateUseData() {
|
|
|
- if (this.$route.query.data) {
|
|
|
- console.log(this.$route.query.data)
|
|
|
- createFolderData(this.formData).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.centerDialogVisible = false
|
|
|
- this.$message({ type: 'success', message: res.msg, duration: 1000 })
|
|
|
- this.createCaseCode = false
|
|
|
- this.dataShow = true
|
|
|
- this.data1 = []
|
|
|
- this.AllQueryFolderData()
|
|
|
- } else {
|
|
|
- this.$message({ type: 'error', message: res.msg, duration: 1000 })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- // 图片上传成功的回调(编辑)
|
|
|
- constractSuccUpload(response, file, fileList) {
|
|
|
- this.dis = false
|
|
|
- const fileUrl = { name: file.name, url: 'http:' + file.response.url }
|
|
|
- this.uptataKey.push(fileUrl)
|
|
|
- },
|
|
|
|
|
|
// 添加事件
|
|
|
add() {
|
|
@@ -252,58 +133,33 @@ export default {
|
|
|
this.data.splice(e, 1)
|
|
|
},
|
|
|
|
|
|
- deleteURL(vel) {
|
|
|
- for (var i = 0; i < this.uptataKey.length; i++) {
|
|
|
- if (this.uptataKey[i].name === vel.name) {
|
|
|
- this.uptataKey.splice(i, 1)
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
// 新建Data
|
|
|
- caseCreateCase(vel, e) {
|
|
|
- if (e === '编辑') {
|
|
|
- this.caseData = vel
|
|
|
- this.caseData.accessory = JSON.stringify(this.uptataKey)
|
|
|
- updateCaseData(this.caseData).then(res => {
|
|
|
- this.$message({ type: 'success', message: res.msg })
|
|
|
- this.$router.go(-1)
|
|
|
- })
|
|
|
- }
|
|
|
- if (e === '新增') {
|
|
|
- this.$refs['caseData'].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.caseData = vel
|
|
|
- this.caseData.caseInfos = this.data
|
|
|
- this.caseData.creator = this.userNames
|
|
|
- this.caseData.modifier = this.userNames
|
|
|
- this.caseData.caseFolderId = this.startId
|
|
|
- this.caseData.bizId = this.bizJson
|
|
|
- createCaseData(this.caseData).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.gridData = res.data
|
|
|
- this.$message({ type: 'success', message: res.msg, duration: 1000 })
|
|
|
- this.$router.go('-1')
|
|
|
- } else {
|
|
|
- this.$notify({ title: '提示', message: res.msg, duration: 1000 })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ caseCreateCase(vel) {
|
|
|
+ this.$refs['caseData'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.caseData = vel
|
|
|
+ this.caseData.caseInfos = this.data
|
|
|
+ this.caseData.creator = this.userNames
|
|
|
+ this.caseData.modifier = this.userNames
|
|
|
+ this.caseData.caseFolderId = this.startId
|
|
|
+ this.caseData.bizId = this.bizJson
|
|
|
+ createCaseData(this.caseData).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.gridData = res.data
|
|
|
+ this.$message({ type: 'success', message: res.msg, duration: 1000 })
|
|
|
+ this.$router.go('-1')
|
|
|
+ } else {
|
|
|
+ this.$notify({ title: '提示', message: res.msg, duration: 1000 })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
-.cla .el-table td {
|
|
|
- padding:0px;
|
|
|
-}
|
|
|
-.deleteSty {
|
|
|
- cursor: pointer;
|
|
|
- border: none;
|
|
|
-}
|
|
|
.bgColorSz {
|
|
|
width: 100%;
|
|
|
height: 96vh;
|