需求编辑接口bug修复
This commit is contained in:
@@ -66,4 +66,13 @@ public class TestProjectController extends BaseController {
|
||||
public AjaxResult delProject(@RequestBody IDQO qo) {
|
||||
return toAjax(testProjectService.deleteTestProjectById(qo.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改需求
|
||||
*/
|
||||
@Log(title = "需求", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/editProject")
|
||||
public AjaxResult editProject(@RequestBody TestProject testProject) {
|
||||
return toAjax(testProjectService.updateTestProject(testProject));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,5 +33,12 @@ public interface TestProjectMapper {
|
||||
* @return
|
||||
*/
|
||||
TestProject selectTestProjectById(Long id);
|
||||
|
||||
/**
|
||||
* 更新需求
|
||||
* @param testProject
|
||||
* @return
|
||||
*/
|
||||
int updateTestProject(TestProject testProject);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,4 +38,11 @@ public interface ITestProjectService {
|
||||
* @return
|
||||
*/
|
||||
public TestProject selectTestProjectById(Long id);
|
||||
|
||||
/**
|
||||
* 修改需求
|
||||
* @param testProject
|
||||
* @return
|
||||
*/
|
||||
public int updateTestProject(TestProject testProject);
|
||||
}
|
||||
|
||||
@@ -63,4 +63,14 @@ public class TestProjectServiceImpl implements ITestProjectService {
|
||||
return testProjectMapper.selectTestProjectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改需求
|
||||
* @param testProject
|
||||
* @return int
|
||||
*/
|
||||
@Override
|
||||
public int updateTestProject(TestProject testProject) {
|
||||
testProject.setUpdateTime(DateUtils.getNowDate());
|
||||
return testProjectMapper.updateTestProject(testProject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,27 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateTestProject" parameterType="TestProject">
|
||||
update test_project
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="serialNumber != null and serialNumber != ''">serial_number = #{serialNumber},</if>
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="outline != null and outline != ''">outline = #{outline},</if>
|
||||
<if test="detail != null and detail != ''">detail = #{detail},</if>
|
||||
<if test="priority != null and priority != ''">priority = #{priority},</if>
|
||||
<if test="estimatedTime != null">estimated_time = #{estimatedTime},</if>
|
||||
<if test="source != null and source != ''">source = #{source},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="manager != null and manager != ''">manager = #{manager},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="version != null">version = #{version},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTestProjectById">
|
||||
DELETE
|
||||
FROM test_project
|
||||
|
||||
@@ -5,7 +5,8 @@ const api = {
|
||||
projectList: 'test/project/projectList',
|
||||
addProject: 'test/project/addProject',
|
||||
delProject: 'test/project/delProject',
|
||||
getProjectDetail: 'test/project/projectDetail'
|
||||
getProjectDetail: 'test/project/projectDetail',
|
||||
updateProject: 'test/project/editProject'
|
||||
}
|
||||
|
||||
export function managerList(data) {
|
||||
@@ -49,3 +50,11 @@ export function getProjectDetail(id) {
|
||||
})
|
||||
}
|
||||
|
||||
export function updateProject(data) {
|
||||
return request({
|
||||
url: api.updateProject,
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -22,16 +22,16 @@
|
||||
@click="handleCollapse(!activeNames.includes('1'))"
|
||||
>高级筛选
|
||||
</el-button>
|
||||
<el-dropdown trigger="click" placement="bottom-end">
|
||||
<span class="el-dropdown-link">
|
||||
列表视图<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item>列表视图</el-dropdown-item>
|
||||
<el-dropdown-item>看板视图</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-button type="primary" size="medium" style="margin-left: 10px;" @click="addProjectVue">新建需求</el-button>
|
||||
<!-- <el-dropdown trigger="click" placement="bottom-end">-->
|
||||
<!-- <span class="el-dropdown-link">-->
|
||||
<!-- 列表视图<i class="el-icon-arrow-down el-icon--right"></i>-->
|
||||
<!-- </span>-->
|
||||
<!-- <el-dropdown-menu slot="dropdown">-->
|
||||
<!-- <el-dropdown-item>列表视图</el-dropdown-item>-->
|
||||
<!-- <el-dropdown-item>看板视图</el-dropdown-item>-->
|
||||
<!-- </el-dropdown-menu>-->
|
||||
<!-- </el-dropdown>-->
|
||||
<el-button icon="el-icon-plus" type="primary" size="medium" style="margin-left: 10px;" @click="addProjectVue">新建需求</el-button>
|
||||
</div>
|
||||
</el-header>
|
||||
</el-col>
|
||||
@@ -144,7 +144,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人" prop="manager">
|
||||
<el-select v-model="form.manager" placeholder="请选择负责人" clearable>
|
||||
<SimpleOptions :options="managerList"/>
|
||||
<Simple-options :options="managerList"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="优先级" prop="priority">
|
||||
@@ -245,7 +245,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addProject, delProject, getProjectDetail, getProjectList, managerList} from "@/api/test/project";
|
||||
import {addProject, delProject, getProjectDetail, getProjectList, managerList, updateProject} from "@/api/test/project";
|
||||
import SimpleOptions from "@/components/FormItem/option/SimpleOptions.vue";
|
||||
|
||||
export default {
|
||||
@@ -289,6 +289,7 @@ export default {
|
||||
title: '',
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
editSubmitLoading: false,
|
||||
submitLoading: false,
|
||||
//新增弹窗
|
||||
addOpen: false,
|
||||
@@ -440,11 +441,31 @@ export default {
|
||||
this.title = '编辑需求'
|
||||
getProjectDetail(id).then((res) => {
|
||||
this.editForm = res.data
|
||||
this.editForm.manager = parseInt(res.data.manager, 10);
|
||||
this.editOpen = true
|
||||
})
|
||||
},
|
||||
editSubmitForm() {
|
||||
|
||||
const form = {
|
||||
...this.editForm,
|
||||
}
|
||||
this.$refs?.editForm.validate((valid) => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
})
|
||||
this.editSubmitLoading = true
|
||||
updateProject(form)
|
||||
.then(() => {
|
||||
this.$message.success('编辑成功')
|
||||
this.editSubmitLoading = false
|
||||
this.editOpen = false
|
||||
this.getList()
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.error('编辑失败')
|
||||
this.editSubmitLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user