Commit 90c9e279 authored by jiaxu.yan's avatar jiaxu.yan

feat: 修改开始试验任务的接口

parent ccd0d795
...@@ -44,11 +44,11 @@ ...@@ -44,11 +44,11 @@
</template> </template>
<script> <script>
import { import {
getCaseByScenario,
getScenarioList, getScenarioList,
reviewTaskStart reviewTaskStart,
createProject,
getUseCaseListByScenario
} from '@/api/task/task' } from '@/api/task/task'
import { FastTestProject } from '@/api/graphql/client.graphql'
export default { export default {
props: { props: {
dialogManger: { dialogManger: {
...@@ -64,7 +64,9 @@ export default { ...@@ -64,7 +64,9 @@ export default {
data() { data() {
return { return {
model: { model: {
scenarioNameList: [] searchFields: {
scenario: []
}
}, },
loading: false, loading: false,
testScenarioList: [] testScenarioList: []
...@@ -75,7 +77,9 @@ export default { ...@@ -75,7 +77,9 @@ export default {
if (newValue) { if (newValue) {
this.getScenario() this.getScenario()
this.model = { this.model = {
scenarioNameList: [] searchFields: {
scenario: []
}
} }
} }
} }
...@@ -90,13 +94,13 @@ export default { ...@@ -90,13 +94,13 @@ export default {
const params = { const params = {
id: this.dialogManger.item.id id: this.dialogManger.item.id
} }
const res = await getCaseByScenario(this.model) const res = await getUseCaseListByScenario(this.model)
if (res.code === 200) { if (res.code === 200) {
const resp = await this.newFileTest({ const resp = await this.newFileTest({
name: this.dialogManger.item.taskName, name: this.dialogManger.item.taskName,
caseIdList: res.data caseIdList: res.data
}) })
params.testSchemeId = resp.data.projectMutation.project.id params.testSchemeId = resp.data
this.startTaskModel(params) this.startTaskModel(params)
} }
}, },
...@@ -121,17 +125,9 @@ export default { ...@@ -121,17 +125,9 @@ export default {
* 对接车联网新建测试项目 * 对接车联网新建测试项目
*/ */
async newFileTest(task) { async newFileTest(task) {
const res = await this.$apollo.mutate({ const res = await createProject({
// fetchPolicy: 'no-cache',
mutation: FastTestProject,
variables: {
name: task.name, name: task.name,
lawId: 'law_items;106', useCaseList: task.caseIdList
principalUserId: 'user_items;2',
systemId: 'system;1',
caseIdList: task.caseIdList,
fileList: ['file_management_items;2']
}
}) })
return res return res
}, },
...@@ -147,15 +143,16 @@ export default { ...@@ -147,15 +143,16 @@ export default {
}) })
}, },
handleTestScenario(item) { handleTestScenario(item) {
if (this.model.scenarioNameList.includes(item.label)) { console.log(this.model)
this.model.scenarioNameList.splice( if (this.model.searchFields.scenario.includes(item.label)) {
this.model.scenarioNameList.indexOf(item.label), this.model.searchFields.scenario.splice(
this.model.searchFields.scenario.indexOf(item.label),
1 1
) )
item.check = false item.check = false
} else { } else {
item.check = true item.check = true
this.model.scenarioNameList.push(item.label) this.model.searchFields.scenario.push(item.label)
} }
}, },
// 全选 // 全选
...@@ -163,7 +160,7 @@ export default { ...@@ -163,7 +160,7 @@ export default {
this.testScenarioList.forEach(obj => { this.testScenarioList.forEach(obj => {
obj.check = true obj.check = true
}) })
this.model.scenarioNameList = this.testScenarioList.map(obj => { this.model.searchFields.scenario = this.testScenarioList.map(obj => {
return obj.label return obj.label
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment