|
|
@@ -15,17 +15,7 @@ const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
console.log(route.query.id)
|
|
|
|
|
|
-const temp1 = [
|
|
|
- {
|
|
|
- "编号": "TC001.1",
|
|
|
- "用例标题": "用户未登录",
|
|
|
- "简短描述": "验证用户未登录时无法访问新增挡板页面"
|
|
|
- },
|
|
|
- {
|
|
|
- "编号": "TC002.1",
|
|
|
- "用例标题": "用户登录",
|
|
|
- "简短描述": "验证用户登录后能否访问挡板设置"
|
|
|
- },
|
|
|
+const temp1 = [{"编号": "TC001.1", "用例标题": "用户未登录", "简短描述": "验证用户未登录时无法访问新增挡板页面"}, {"编号": "TC002.1", "用例标题": "用户登录", "简短描述": "验证用户登录后能否访问挡板设置"},
|
|
|
{
|
|
|
"编号": "TC003.1",
|
|
|
"用例标题": "访问挡板配置",
|
|
|
@@ -199,20 +189,51 @@ const handleImproveButton = (p: { row: any }) => {
|
|
|
|
|
|
axios(config)
|
|
|
.then((response: AxiosResponse<any>) => {
|
|
|
+ //const test = " [{\"编号\":\"TC001.1\", \"用例标题\": \"用户未登录\", \"简短描述\": \"验证用户未登录时无法访问新增挡板页面\"}, {\"编号\": \"TC002.1\", \"用例标题\": \"用户登录\", \"简短描述\": \"验证用户登录后能否访问挡板设置\"}]"
|
|
|
console.log(response.data.output);
|
|
|
const output = JSON.stringify(JSON.parse(response.data.output))
|
|
|
- //更新用例列表
|
|
|
- useStore.DocxList[itemIndex.value].docxMessageList = parseOutput(output);
|
|
|
- testCase.value = useStore.DocxList[itemIndex.value].docxMessageList;
|
|
|
- //更新操作记录
|
|
|
- console.log(actionList.value)
|
|
|
- useStore.DocxList[itemIndex.value].actionList.push({
|
|
|
- description: "细化用例 "+improve_id,
|
|
|
- time: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
|
- })
|
|
|
- console.log(useStore.DocxList[itemIndex.value].actionList)
|
|
|
- actionList.value = useStore.DocxList[itemIndex.value].actionList;
|
|
|
- console.log(actionList.value)
|
|
|
+ console.log(output)
|
|
|
+ for (let item of useStore.taskList){
|
|
|
+ console.log(item.testCaseListId)
|
|
|
+ if(item.testCaseListId == itemIndex.value){
|
|
|
+ const improveList = parseOutput(output)
|
|
|
+ //更新用例列表
|
|
|
+ item.testCaseList = JSON.stringify(improveList)
|
|
|
+ console.log(item)
|
|
|
+ testCase.value = improveList
|
|
|
+ //更新操作记录
|
|
|
+ let lastActionList: Action[] = JSON.parse(item.actionList)
|
|
|
+ const action = {description: "细化用例 "+improve_id, times: dayjs().format('YYYY-MM-DD HH:mm:ss')}
|
|
|
+ lastActionList.push(action)
|
|
|
+ item.actionList = JSON.stringify(lastActionList)
|
|
|
+ actionList.value = JSON.parse(item.actionList)
|
|
|
+ //写进数据库
|
|
|
+ axios({
|
|
|
+ url: "http://localhost:8081/testCaseList/modify", // 请求地址
|
|
|
+ method: "post", // 请求方法
|
|
|
+ headers: { // 请求头
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ },
|
|
|
+ data: { // 请求参数
|
|
|
+ userId: item.userId,
|
|
|
+ creatTime: item.creatTime,
|
|
|
+ docxName: item.docxName,
|
|
|
+ testCaseList: item.testCaseList,
|
|
|
+ actionList: item.actionList,
|
|
|
+ tcFinalList: item.tcFinalList
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ if(res.data.msg !== "更新成功!"){
|
|
|
+ ElMessage({
|
|
|
+ message: '数据库出错',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ useStore.saveTaskList()
|
|
|
loadingImprove.close()
|
|
|
})
|
|
|
.catch((error: AxiosError<any>) => {
|
|
|
@@ -259,26 +280,56 @@ const deteleList = (scope: { row: any }) => {
|
|
|
axios(deleteConfig)
|
|
|
.then((response: AxiosResponse<any>) => {
|
|
|
console.log(response.data.output);
|
|
|
+ //const test = " [{\"编号\":\"TC001.1\", \"用例标题\": \"用户未登录\", \"简短描述\": \"验证用户未登录时无法访问新增挡板页面\"}, {\"编号\": \"TC002.1\", \"用例标题\": \"用户登录\", \"简短描述\": \"验证用户登录后能否访问挡板设置\"}]"
|
|
|
+
|
|
|
const output = JSON.stringify(JSON.parse(response.data.output))
|
|
|
- //更新用例列表
|
|
|
- useStore.DocxList[itemIndex.value].docxMessageList = parseOutput(output);
|
|
|
- testCase.value = useStore.DocxList[itemIndex.value].docxMessageList;
|
|
|
- //更新操作记录
|
|
|
- useStore.DocxList[itemIndex.value].actionList.push({
|
|
|
- description: "删除用例 "+delete_id,
|
|
|
- time: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
|
- })
|
|
|
- useStore.saveDocxList()
|
|
|
- console.log(useStore.DocxList[itemIndex.value].actionList)
|
|
|
- actionList.value = useStore.DocxList[itemIndex.value].actionList;
|
|
|
- useStore.saveDocxList()
|
|
|
- console.log(actionList.value)
|
|
|
+ console.log(output)
|
|
|
+ for (let item of useStore.taskList){
|
|
|
+ console.log(item.testCaseListId)
|
|
|
+ if(item.testCaseListId == itemIndex.value){
|
|
|
+ const improveList = parseOutput(output)
|
|
|
+ //更新用例列表
|
|
|
+ item.testCaseList = JSON.stringify(improveList)
|
|
|
+ console.log(item)
|
|
|
+ testCase.value = improveList
|
|
|
+ //更新操作记录
|
|
|
+ let lastActionList: Action[] = JSON.parse(item.actionList)
|
|
|
+ const action = {description: "删除用例 "+delete_id, times: dayjs().format('YYYY-MM-DD HH:mm:ss')}
|
|
|
+ lastActionList.push(action)
|
|
|
+ item.actionList = JSON.stringify(lastActionList)
|
|
|
+ actionList.value = JSON.parse(item.actionList)
|
|
|
+ //写进数据库
|
|
|
+ axios({
|
|
|
+ url: "http://localhost:8081/testCaseList/modify", // 请求地址
|
|
|
+ method: "post", // 请求方法
|
|
|
+ headers: { // 请求头
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ },
|
|
|
+ data: { // 请求参数
|
|
|
+ userId: item.userId,
|
|
|
+ creatTime: item.creatTime,
|
|
|
+ docxName: item.docxName,
|
|
|
+ testCaseList: item.testCaseList,
|
|
|
+ actionList: item.actionList,
|
|
|
+ tcFinalList: item.tcFinalList
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ if(res.data.msg !== "更新成功!"){
|
|
|
+ ElMessage({
|
|
|
+ message: '数据库出错',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ useStore.saveTaskList()
|
|
|
loadingDelete.close()
|
|
|
})
|
|
|
.catch((error: AxiosError<any>) => {
|
|
|
console.log(error);
|
|
|
});
|
|
|
-
|
|
|
}
|
|
|
|
|
|
//添加用例
|
|
|
@@ -319,29 +370,51 @@ const addDocxList = () => {
|
|
|
|
|
|
axios(addConfig)
|
|
|
.then((response: AxiosResponse<any>) => {
|
|
|
- console.log(JSON.stringify(response.data));
|
|
|
+ console.log(response.data.output);
|
|
|
const output = JSON.stringify(JSON.parse(response.data.output))
|
|
|
-
|
|
|
- //更新用例列表
|
|
|
- useStore.DocxList[itemIndex.value].docxMessageList = parseOutput(output);
|
|
|
- useStore.saveDocxList()
|
|
|
- testCase.value = useStore.DocxList[itemIndex.value].docxMessageList
|
|
|
- //更新操作记录
|
|
|
- useStore.DocxList[itemIndex.value].actionList.push({
|
|
|
- description: "添加用例 ",
|
|
|
- time: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
|
- })
|
|
|
- console.log(useStore.DocxList[itemIndex.value].actionList)
|
|
|
- useStore.saveDocxList()
|
|
|
- actionList.value = useStore.DocxList[itemIndex.value].actionList;
|
|
|
-
|
|
|
- console.log(actionList.value)
|
|
|
+ console.log(output)
|
|
|
+ for (let item of useStore.taskList){
|
|
|
+ console.log(item.testCaseListId)
|
|
|
+ if(item.testCaseListId == itemIndex.value){
|
|
|
+ const improveList = parseOutput(output)
|
|
|
+ //更新用例列表
|
|
|
+ item.testCaseList = JSON.stringify(improveList)
|
|
|
+ console.log(item)
|
|
|
+ testCase.value = improveList
|
|
|
+ //更新操作记录
|
|
|
+ let lastActionList: Action[] = JSON.parse(item.actionList)
|
|
|
+ const action = {description: "添加用例 ", times: dayjs().format('YYYY-MM-DD HH:mm:ss')}
|
|
|
+ lastActionList.push(action)
|
|
|
+ item.actionList = JSON.stringify(lastActionList)
|
|
|
+ actionList.value = JSON.parse(item.actionList)
|
|
|
+ //写进数据库
|
|
|
+ axios({
|
|
|
+ url: "http://localhost:8081/testCaseList/modify", // 请求地址
|
|
|
+ method: "post", // 请求方法
|
|
|
+ headers: { // 请求头
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ },
|
|
|
+ data: { // 请求参数
|
|
|
+ userId: item.userId,
|
|
|
+ creatTime: item.creatTime,
|
|
|
+ docxName: item.docxName,
|
|
|
+ testCaseList: item.testCaseList,
|
|
|
+ actionList: item.actionList,
|
|
|
+ tcFinalList: item.tcFinalList
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ if(res.data.msg !== "更新成功!"){
|
|
|
+ ElMessage({
|
|
|
+ message: '数据库出错',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ useStore.saveTaskList()
|
|
|
loadingAdd.close()
|
|
|
- ElMessage({
|
|
|
- message: '添加成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- textarea.value = ''
|
|
|
})
|
|
|
.catch((error: AxiosError<any>) => {
|
|
|
console.log(error);
|
|
|
@@ -457,7 +530,7 @@ const addDocxList = () => {
|
|
|
<div class="header-Box">
|
|
|
|
|
|
<el-timeline>
|
|
|
- <el-timeline-item v-for="(action, index) in actionList" :key="index" :timestamp="action.time"
|
|
|
+ <el-timeline-item v-for="(action, index) in actionList" :key="index" :timestamp="action.times"
|
|
|
size=large>
|
|
|
{{ action.description }}
|
|
|
</el-timeline-item>
|