添加房屋名称

main
hansha 2 years ago
parent 835f8924fb
commit a376bb2626

@ -1,8 +1,9 @@
package com.ruoyi.szxc.domain; package com.ruoyi.szxc.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* szxc_cs_fw * szxc_cs_fw
@ -20,6 +21,10 @@ public class SzxcCsFw extends BaseEntity
/** 房屋id */ /** 房屋id */
private Long fwId; private Long fwId;
/** 房屋名称 */
@Excel(name = "房屋名称")
private String fwName;
public void setCsId(Long csId) public void setCsId(Long csId)
{ {
this.csId = csId; this.csId = csId;
@ -38,12 +43,22 @@ public class SzxcCsFw extends BaseEntity
{ {
return fwId; return fwId;
} }
public void setFwName(String fwName)
{
this.fwName = fwName;
}
public String getFwName()
{
return fwName;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("csId", getCsId()) .append("csId", getCsId())
.append("fwId", getFwId()) .append("fwId", getFwId())
.toString(); .append("fwName", getFwName())
.toString();
} }
} }

@ -1,21 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.szxc.mapper.SzxcCsFwMapper"> <mapper namespace="com.ruoyi.szxc.mapper.SzxcCsFwMapper">
<resultMap type="SzxcCsFw" id="SzxcCsFwResult"> <resultMap type="SzxcCsFw" id="SzxcCsFwResult">
<result property="csId" column="cs_id" /> <result property="csId" column="cs_id" />
<result property="fwId" column="fw_id" /> <result property="fwId" column="fw_id" />
<result property="fwName" column="fw_name" />
</resultMap> </resultMap>
<sql id="selectSzxcCsFwVo"> <sql id="selectSzxcCsFwVo">
select cs_id, fw_id from szxc_cs_fw select cs_id, fw_id, fw_name from szxc_cs_fw
</sql> </sql>
<select id="selectSzxcCsFwList" parameterType="SzxcCsFw" resultMap="SzxcCsFwResult"> <select id="selectSzxcCsFwList" parameterType="SzxcCsFw" resultMap="SzxcCsFwResult">
<include refid="selectSzxcCsFwVo"/> <include refid="selectSzxcCsFwVo"/>
<where> <where>
<if test="fwName != null and fwName != ''"> and fw_name like concat('%', #{fwName}, '%')</if>
</where> </where>
</select> </select>
@ -29,17 +31,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="csId != null">cs_id,</if> <if test="csId != null">cs_id,</if>
<if test="fwId != null">fw_id,</if> <if test="fwId != null">fw_id,</if>
</trim> <if test="fwName != null and fwName != ''">fw_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="csId != null">#{csId},</if> <if test="csId != null">#{csId},</if>
<if test="fwId != null">#{fwId},</if> <if test="fwId != null">#{fwId},</if>
</trim> <if test="fwName != null and fwName != ''">#{fwName},</if>
</trim>
</insert> </insert>
<update id="updateSzxcCsFw" parameterType="SzxcCsFw"> <update id="updateSzxcCsFw" parameterType="SzxcCsFw">
update szxc_cs_fw update szxc_cs_fw
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="fwId != null">fw_id = #{fwId},</if> <if test="fwId != null">fw_id = #{fwId},</if>
<if test="fwName != null and fwName != ''">fw_name = #{fwName},</if>
</trim> </trim>
where cs_id = #{csId} where cs_id = #{csId}
</update> </update>

@ -1,6 +1,14 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="房屋名称" prop="fwName">
<el-input
v-model="queryParams.fwName"
placeholder="请输入房屋名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <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> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -57,6 +65,7 @@
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="场所id" align="center" prop="csId" /> <el-table-column label="场所id" align="center" prop="csId" />
<el-table-column label="房屋id" align="center" prop="fwId" /> <el-table-column label="房屋id" align="center" prop="fwId" />
<el-table-column label="房屋名称" align="center" prop="fwName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -88,6 +97,9 @@
<!-- 添加或修改场所房屋关联对话框 --> <!-- 添加或修改场所房屋关联对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="房屋名称" prop="fwName">
<el-input v-model="form.fwName" placeholder="请输入房屋名称" />
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -98,136 +110,141 @@
</template> </template>
<script> <script>
import { listCs_fw, getCs_fw, delCs_fw, addCs_fw, updateCs_fw } from "@/api/szxc/cs_fw"; import { listCs_fw, getCs_fw, delCs_fw, addCs_fw, updateCs_fw } from "@/api/szxc/cs_fw";
export default { export default {
name: "Cs_fw", name: "Cs_fw",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
cs_fwList: [], cs_fwList: [],
// //
title: "", title: "",
// //
open: false, open: false,
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}, fwName: null
// },
form: {}, //
// form: {},
rules: { //
} rules: {
}; fwName: [
}, { required: true, message: "房屋名称不能为空", trigger: "blur" }
created() { ]
this.getList(); }
},
methods: {
/** 查询场所房屋关联列表 */
getList() {
this.loading = true;
listCs_fw(this.queryParams).then(response => {
this.cs_fwList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
csId: null,
fwId: null
}; };
this.resetForm("form");
}, },
/** 搜索按钮操作 */ created() {
handleQuery() {
this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ methods: {
resetQuery() { /** 查询场所房屋关联列表 */
this.resetForm("queryForm"); getList() {
this.handleQuery(); this.loading = true;
}, listCs_fw(this.queryParams).then(response => {
// this.cs_fwList = response.rows;
handleSelectionChange(selection) { this.total = response.total;
this.ids = selection.map(item => item.csId) this.loading = false;
this.single = selection.length!==1 });
this.multiple = !selection.length },
}, //
/** 新增按钮操作 */ cancel() {
handleAdd() { this.open = false;
this.reset(); this.reset();
this.open = true; },
this.title = "添加场所房屋关联"; //
}, reset() {
/** 修改按钮操作 */ this.form = {
handleUpdate(row) { csId: null,
this.reset(); fwId: null,
const csId = row.csId || this.ids fwName: null
getCs_fw(csId).then(response => { };
this.form = response.data; this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.csId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true; this.open = true;
this.title = "修改场所房屋关联"; this.title = "添加场所房屋关联";
}); },
}, /** 修改按钮操作 */
/** 提交按钮 */ handleUpdate(row) {
submitForm() { this.reset();
this.$refs["form"].validate(valid => { const csId = row.csId || this.ids
if (valid) { getCs_fw(csId).then(response => {
if (this.form.csId != null) { this.form = response.data;
updateCs_fw(this.form).then(response => { this.open = true;
this.$modal.msgSuccess("修改成功"); this.title = "修改场所房屋关联";
this.open = false; });
this.getList(); },
}); /** 提交按钮 */
} else { submitForm() {
addCs_fw(this.form).then(response => { this.$refs["form"].validate(valid => {
this.$modal.msgSuccess("新增成功"); if (valid) {
this.open = false; if (this.form.csId != null) {
this.getList(); updateCs_fw(this.form).then(response => {
}); this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCs_fw(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
} }
} });
}); },
}, /** 删除按钮操作 */
/** 删除按钮操作 */ handleDelete(row) {
handleDelete(row) { const csIds = row.csId || this.ids;
const csIds = row.csId || this.ids; this.$modal.confirm('是否确认删除场所房屋关联编号为"' + csIds + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除场所房屋关联编号为"' + csIds + '"的数据项?').then(function() { return delCs_fw(csIds);
return delCs_fw(csIds); }).then(() => {
}).then(() => { this.getList();
this.getList(); this.$modal.msgSuccess("删除成功");
this.$modal.msgSuccess("删除成功"); }).catch(() => {});
}).catch(() => {}); },
}, /** 导出按钮操作 */
/** 导出按钮操作 */ handleExport() {
handleExport() { this.download('szxc/cs_fw/export', {
this.download('szxc/cs_fw/export', { ...this.queryParams
...this.queryParams }, `cs_fw_${new Date().getTime()}.xlsx`)
}, `cs_fw_${new Date().getTime()}.xlsx`) }
} }
} };
};
</script> </script>

Loading…
Cancel
Save