实训场地管理增加属性:适用专业(添加+修改+查询条件+列表)+操作栏增加删除功能

This commit is contained in:
buliping committed 2026-09-29 14:59:53 +08:00
1 parent 0bf7d961ab
commit 973cc0e7e3
4 files changed
+60 -4

No files matched your search

@@ -4,6 +4,7 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
@@ -67,6 +68,17 @@ public class TrainTrainingSiteController extends BaseController
return toAjax(trainTrainingSiteService.insertTrainTrainingSite(trainTrainingSite));
}
/**
* 删除实训场地 (RESTful DELETE /train/training-site/{siteIds})
*/
@PreAuthorize("@ss.hasPermi('train:site:edit')")
@Log(title = "实训场地", businessType = BusinessType.DELETE)
@DeleteMapping("/{siteIds}")
public AjaxResult remove(@PathVariable String[] siteIds)
{
return toAjax(trainTrainingSiteService.deleteTrainTrainingSiteBySiteIds(siteIds));
}
/**
* 修改实训场地 (RESTful PUT /train/training-site/{siteId})
*/
@@ -29,10 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTrainTrainingSiteVo"/>
where del_flag = '0'
<if test="siteName != null and siteName != ''"> and site_name like concat('%', #{siteName}, '%')</if>
<if test="siteLocation != null and siteLocation != ''"> and site_location = #{siteLocation}</if>
<if test="siteLocation != null and siteLocation != ''"> and site_location like concat('%', #{siteLocation}, '%')</if>
<if test="capacity != null "> and capacity = #{capacity}</if>
<if test="siteDevice != null and siteDevice != ''"> and site_device = #{siteDevice}</if>
<if test="siteStatus != null "> and site_status = #{siteStatus}</if>
<if test="major != null and major != ''"> and major like concat('%', #{major}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
order by create_time desc
</select>
+8
View File
@@ -26,6 +26,14 @@ export function addSite(data) {
})
}
// 删除实训场地
export function delSite(ids) {
return request({
url: '/train/training-site/' + ids,
method: 'delete'
})
}
// 修改实训场地
export function updateSite(data) {
return request({
+38 -3
View File
@@ -23,6 +23,14 @@
<el-option label="停用" :value="0" />
</el-select>
</el-form-item>
<el-form-item label="适用专业" prop="major">
<el-input
v-model="queryParams.major"
placeholder="请输入适用专业"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -63,6 +71,7 @@
<el-tag type="info">{{ scope.row.capacity }} 人</el-tag>
</template>
</el-table-column>
<el-table-column label="适用专业" align="center" prop="major" :show-overflow-tooltip="true" />
<el-table-column label="配套设备描述" align="center" prop="siteDevice" :show-overflow-tooltip="true" />
<el-table-column label="场地状态" align="center" prop="siteStatus">
<template slot-scope="scope">
@@ -70,7 +79,7 @@
<el-tag v-else type="danger">停用</el-tag>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<!-- <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@@ -80,6 +89,13 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
v-hasPermi="['train:site:edit']"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -104,6 +120,9 @@
<el-form-item label="最大容纳人数" prop="capacity">
<el-input-number v-model="form.capacity" :min="1" :max="10000" placeholder="最大容纳人数" style="width: 100%" />
</el-form-item>
<el-form-item label="适用专业" prop="major">
<el-input v-model="form.major" placeholder="请输入适用专业 (如 铁道供电技术)" maxlength="100" />
</el-form-item>
<el-form-item label="场地配套设备" prop="siteDevice">
<el-input v-model="form.siteDevice" type="textarea" placeholder="例如:VR头显12套、3D数字孪生演练台等" :rows="3" />
</el-form-item>
@@ -126,7 +145,7 @@
</template>
<script>
import { listSite, getSite, addSite, updateSite } from '@/api/train/site'
import { listSite, getSite, addSite, updateSite, delSite } from '@/api/train/site'
export default {
name: 'TrainingSite',
@@ -157,7 +176,8 @@ export default {
siteName: null,
siteLocation: null,
capacity: null,
siteStatus: null
siteStatus: null,
major: null
},
// 表单参数
form: {},
@@ -211,6 +231,7 @@ export default {
capacity: 30,
siteDevice: null,
siteStatus: 1,
major: null,
remark: null
}
this.resetForm('form')
@@ -231,6 +252,20 @@ export default {
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.siteId || this.ids
if (!ids || (Array.isArray(ids) && ids.length === 0)) {
this.$modal.msgWarning('请选择要删除的数据')
return
}
this.$modal.confirm('是否确认删除场地编号为"' + ids + '"的数据项?').then(function() {
return delSite(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {})
},
/** 新增按钮操作 */
handleAdd() {
this.reset()