评估内容部分代码
This commit is contained in:
parent
6c9880a58e
commit
3dbe1e5003
ruoyi-ui/src/views/benyi/assessmentcontent
ruoyi/src/main
java/com/ruoyi/project/benyi
controller
mapper
service
resources/mybatis/benyi
@ -23,14 +23,6 @@
|
||||
@click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@ -39,30 +31,11 @@
|
||||
v-hasPermi="['benyi:assessmentcontent:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['benyi:assessmentcontent:edit']"
|
||||
>修改</el-button
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['benyi:assessmentcontent:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
@ -72,7 +45,6 @@
|
||||
default-expand-all
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="评估名称" align="center" prop="name" />
|
||||
<el-table-column
|
||||
label="是否元素"
|
||||
@ -93,6 +65,7 @@
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="scope.row.parentId !== 0"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@ -101,6 +74,7 @@
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="scope.row.parentId !== 0"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@ -251,9 +225,7 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listAssessmentcontent(this.queryParams).then((response) => {
|
||||
// this.assessmentcontentList = response.rows;
|
||||
this.assessmentcontentList = this.handleTree(response.rows, "id");
|
||||
//console.log(this.assessmentcontentList);
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
@ -263,7 +235,6 @@ export default {
|
||||
getTreeselect() {
|
||||
listAssessmentcontent(null).then((response) => {
|
||||
this.parentidOptions = this.handleTree(response.rows, "id");
|
||||
console.log(this.parentidOptions);
|
||||
});
|
||||
},
|
||||
|
||||
@ -329,6 +300,7 @@ export default {
|
||||
const id = row.id || this.ids;
|
||||
getAssessmentcontent(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.form.parentId = response.data.parentId;
|
||||
this.open = true;
|
||||
this.title = "修改评估内容";
|
||||
});
|
||||
@ -359,9 +331,8 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm(
|
||||
'是否确认删除评估内容的数据项?',
|
||||
'是否确认删除名称为"' + row.name + '"的数据项?',
|
||||
"警告",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
@ -370,7 +341,7 @@ export default {
|
||||
}
|
||||
)
|
||||
.then(function () {
|
||||
return delAssessmentcontent(ids);
|
||||
return delAssessmentcontent(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
|
@ -113,9 +113,12 @@ public class ByAssessmentcontentController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:assessmentcontent:remove')")
|
||||
@Log(title = "评估内容", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return toAjax(byAssessmentcontentService.deleteByAssessmentcontentByIds(ids));
|
||||
if (byAssessmentcontentService.hasChildByAssessmentcontentId(id)) {
|
||||
return AjaxResult.error("存在下级内容,不允许删除");
|
||||
}
|
||||
return toAjax(byAssessmentcontentService.deleteByAssessmentcontentById(id));
|
||||
}
|
||||
}
|
||||
|
@ -58,4 +58,12 @@ public interface ByAssessmentcontentMapper {
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByAssessmentcontentByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 是否存在子节点
|
||||
*
|
||||
* @param id 内容ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int hasChildByAssessmentcontentId(Long id);
|
||||
}
|
||||
|
@ -60,6 +60,14 @@ public interface IByAssessmentcontentService {
|
||||
*/
|
||||
public int updateByAssessmentcontent(ByAssessmentcontent byAssessmentcontent);
|
||||
|
||||
/**
|
||||
* 是否存在内容子节点
|
||||
*
|
||||
* @param id 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean hasChildByAssessmentcontentId(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除评估内容
|
||||
*
|
||||
|
@ -108,6 +108,18 @@ public class ByAssessmentcontentServiceImpl implements IByAssessmentcontentServi
|
||||
return byAssessmentcontentMapper.updateByAssessmentcontent(byAssessmentcontent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否存在子节点
|
||||
*
|
||||
* @param id 内容ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildByAssessmentcontentId(Long id) {
|
||||
int result = byAssessmentcontentMapper.hasChildByAssessmentcontentId(id);
|
||||
return result > 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除评估内容
|
||||
*
|
||||
|
@ -33,6 +33,11 @@
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="hasChildByAssessmentcontentId" parameterType="Long" resultType="int">
|
||||
select count(1) from by_assessmentcontent
|
||||
where parentId = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertByAssessmentcontent" parameterType="ByAssessmentcontent" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into by_assessmentcontent
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
Loading…
x
Reference in New Issue
Block a user