Commit b32ad212 authored by wanghao's avatar wanghao

1 台账管理-安全装置台账 调整成企业和政府都可以录,企业看自己,政府看所有,及导出调整。

parent f471396f
...@@ -62,6 +62,18 @@ public class TSafeEquipmentStandingBook extends BaseEntity ...@@ -62,6 +62,18 @@ public class TSafeEquipmentStandingBook extends BaseEntity
private String userType; private String userType;
/**
* 所属企业id 不是必填
*/
private String enterpriseId;
/**
* 所属企业name 查询 和 导出使用
*/
/** 备注 */
@Excel(name = "所属企业")
private String enterpriseName;
public static long getSerialVersionUID() { public static long getSerialVersionUID() {
return serialVersionUID; return serialVersionUID;
} }
...@@ -174,6 +186,22 @@ public class TSafeEquipmentStandingBook extends BaseEntity ...@@ -174,6 +186,22 @@ public class TSafeEquipmentStandingBook extends BaseEntity
return remarks; return remarks;
} }
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getEnterpriseName() {
return enterpriseName;
}
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
}
@Override @Override
public String toString() { public String toString() {
return "TSafeEquipmentStandingBook{" + return "TSafeEquipmentStandingBook{" +
......
...@@ -32,4 +32,6 @@ public class TSafeEquipmentStandingBookForm ...@@ -32,4 +32,6 @@ public class TSafeEquipmentStandingBookForm
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date installTimeEnd; private Date installTimeEnd;
private String enterpriseId;
} }
...@@ -2,8 +2,11 @@ package com.zehong.system.service.impl; ...@@ -2,8 +2,11 @@ package com.zehong.system.service.impl;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.form.TSafeEquipmentStandingBookForm; import com.zehong.system.domain.form.TSafeEquipmentStandingBookForm;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -44,6 +47,11 @@ public class TSafeEquipmentStandingBookServiceImpl implements ITSafeEquipmentSta ...@@ -44,6 +47,11 @@ public class TSafeEquipmentStandingBookServiceImpl implements ITSafeEquipmentSta
@Override @Override
public List<TSafeEquipmentStandingBook> selectTSafeEquipmentStandingBookList(TSafeEquipmentStandingBookForm tSafeEquipmentStandingBook) public List<TSafeEquipmentStandingBook> selectTSafeEquipmentStandingBookList(TSafeEquipmentStandingBookForm tSafeEquipmentStandingBook)
{ {
// 20240725 调整 政府和企业都可以录,企业看自己,政府看所有
if (isEnterprise()) {
tSafeEquipmentStandingBook.setEnterpriseId(SecurityUtils.getLoginUser().getUser().getDeptId());
}
return tSafeEquipmentStandingBookMapper.selectTSafeEquipmentStandingBookList(tSafeEquipmentStandingBook); return tSafeEquipmentStandingBookMapper.selectTSafeEquipmentStandingBookList(tSafeEquipmentStandingBook);
} }
...@@ -105,4 +113,14 @@ public class TSafeEquipmentStandingBookServiceImpl implements ITSafeEquipmentSta ...@@ -105,4 +113,14 @@ public class TSafeEquipmentStandingBookServiceImpl implements ITSafeEquipmentSta
{ {
return tSafeEquipmentStandingBookMapper.deleteTSafeEquipmentStandingBookById(safeEquipmentId); return tSafeEquipmentStandingBookMapper.deleteTSafeEquipmentStandingBookById(safeEquipmentId);
} }
/**
* 判断是否为企业
* @return
*/
private boolean isEnterprise(){
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
List<String> roleKeys = roles.stream().map(item -> item.getRoleKey()).collect(Collectors.toList());
return roleKeys.contains("qy");
}
} }
...@@ -21,22 +21,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -21,22 +21,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isDel" column="is_del" /> <result property="isDel" column="is_del" />
<result property="remarks" column="remarks" /> <result property="remarks" column="remarks" />
<result property="userType" column="user_type" /> <result property="userType" column="user_type" />
<result property="enterpriseId" column="enterprise_id" />
<result property="enterpriseName" column="enterpriseName" />
</resultMap> </resultMap>
<sql id="selectTSafeEquipmentStandingBookVo"> <sql id="selectTSafeEquipmentStandingBookVo">
select safe_equipment_id, user_name, user_no, user_address, id_card, link_mobile, equipment_type, install_time, brand_name, create_by, create_time, update_by, update_time, is_del, remarks,user_type from t_safe_equipment_standing_book select book.safe_equipment_id, book.user_name, book.user_no, book.user_address, book.id_card, book.link_mobile,
book.equipment_type, book.install_time, book.brand_name, book.create_by, book.create_time, book.update_by,
book.update_time, book.is_del, book.remarks,book.user_type,book.enterprise_id,info.enterprise_name as enterpriseName
from t_safe_equipment_standing_book book left join t_enterprise_info info on book.enterprise_id = info.enterprise_id
</sql> </sql>
<select id="selectTSafeEquipmentStandingBookList" parameterType="TSafeEquipmentStandingBookForm" resultMap="TSafeEquipmentStandingBookResult"> <select id="selectTSafeEquipmentStandingBookList" parameterType="TSafeEquipmentStandingBookForm" resultMap="TSafeEquipmentStandingBookResult">
<include refid="selectTSafeEquipmentStandingBookVo"/> <include refid="selectTSafeEquipmentStandingBookVo"/>
<where> is_del = '0' <where> book.is_del = '0'
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if> <if test="userName != null and userName != ''"> and book.user_name like concat('%', #{userName}, '%')</if>
<if test="linkMobile != null and linkMobile != ''"> and link_mobile like concat('%', #{linkMobile}, '%')</if> <if test="linkMobile != null and linkMobile != ''"> and book.link_mobile like concat('%', #{linkMobile}, '%')</if>
<if test="equipmentType != null and equipmentType != ''"> and equipment_type like concat('%', #{equipmentType}, '%')</if> <if test="equipmentType != null and equipmentType != ''"> and book.equipment_type like concat('%', #{equipmentType}, '%')</if>
<if test="installTimeStart != null "> and install_time &gt;= #{installTimeStart}</if> <if test="installTimeStart != null "> and book.install_time &gt;= #{installTimeStart}</if>
<if test="installTimeEnd != null "> and install_time &lt;= #{installTimeEnd}</if> <if test="installTimeEnd != null "> and book.install_time &lt;= #{installTimeEnd}</if>
<if test="enterpriseId != null and enterpriseId != '' "> and book.enterprise_id = #{enterpriseId}</if>
</where> </where>
order by create_time desc order by book.create_time desc
</select> </select>
<select id="selectTSafeEquipmentStandingBookById" parameterType="Long" resultMap="TSafeEquipmentStandingBookResult"> <select id="selectTSafeEquipmentStandingBookById" parameterType="Long" resultMap="TSafeEquipmentStandingBookResult">
...@@ -62,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -62,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null">is_del,</if> <if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if> <if test="remarks != null">remarks,</if>
<if test="userType != null">user_type,</if> <if test="userType != null">user_type,</if>
<if test="enterpriseId != null">enterprise_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null">#{userName},</if> <if test="userName != null">#{userName},</if>
...@@ -79,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -79,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null">#{isDel},</if> <if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if> <if test="remarks != null">#{remarks},</if>
<if test="userType != null">#{userType},</if> <if test="userType != null">#{userType},</if>
<if test="enterpriseId != null">#{enterpriseId},</if>
</trim> </trim>
</insert> </insert>
...@@ -100,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -100,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null">is_del = #{isDel},</if> <if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if> <if test="remarks != null">remarks = #{remarks},</if>
<if test="userType != null">user_type = #{userType},</if> <if test="userType != null">user_type = #{userType},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
</trim> </trim>
where safe_equipment_id = #{safeEquipmentId} where safe_equipment_id = #{safeEquipmentId}
</update> </update>
......
...@@ -191,6 +191,16 @@ ...@@ -191,6 +191,16 @@
<el-input type="textarea" v-model="form.remarks" placeholder="请输入备注信息" /> <el-input type="textarea" v-model="form.remarks" placeholder="请输入备注信息" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col span="12">
<el-form-item label="所属企业" prop="enterpriseId">
<el-select v-model="form.enterpriseId" placeholder="请在下拉框中选择名称" maxlength="255" style="width: 100%;">
<el-option v-for="item in enterpriseList" :key="item.enterpriseId" :label="item.enterpriseName" :value="item.enterpriseId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
...@@ -266,15 +276,22 @@ ...@@ -266,15 +276,22 @@
</el-row> </el-row>
</el-form> </el-form>
</el-dialog> </el-dialog>
<!-- 详情 -->
<DetailInfo ref="detail"/>
</div> </div>
</template> </template>
<script> <script>
import { listEquipment, getEquipment, delEquipment, addEquipment, updateEquipment, exportEquipment } from "@/api/standingBook/equipment"; import { listEquipment, getEquipment, delEquipment, addEquipment, updateEquipment, exportEquipment } from "@/api/standingBook/equipment";
import { selectTEnterprise} from "@/api/regulation/supervise";
import DetailInfo from "./DetailInfo";
export default { export default {
name: "Equipment", name: "Equipment",
components: { components: {
DetailInfo
}, },
data() { data() {
return { return {
...@@ -284,6 +301,8 @@ export default { ...@@ -284,6 +301,8 @@ export default {
exportLoading: false, exportLoading: false,
// 选中数组 // 选中数组
ids: [], ids: [],
// 企业数据
enterpriseList:[],
// 非单个禁用 // 非单个禁用
single: true, single: true,
// 显示搜索条件 // 显示搜索条件
...@@ -343,8 +362,14 @@ export default { ...@@ -343,8 +362,14 @@ export default {
this.getDicts("t_equipment_type").then(response => { this.getDicts("t_equipment_type").then(response => {
this.options = response.data; this.options = response.data;
}); });
this.getEnterp();
}, },
methods: { methods: {
getEnterp(){
selectTEnterprise().then(response => {
this.enterpriseList = response.data;
});
},
change(){ change(){
}, },
...@@ -384,7 +409,8 @@ export default { ...@@ -384,7 +409,8 @@ export default {
updateBy: null, updateBy: null,
updateTime: null, updateTime: null,
isDel: null, isDel: null,
remarks: null remarks: null,
enterpriseId: null
}; };
this.resetForm("form"); this.resetForm("form");
}, },
...@@ -432,7 +458,11 @@ export default { ...@@ -432,7 +458,11 @@ export default {
handleAdd() { handleAdd() {
this.reset1(); this.reset1();
this.open1 = true; this.open1 = true;
this.title1 = "添加用户加装安全装置台账"; this.title1 = "添加用户加装安全装置台账";
// 如果当前是企业,则直接赋值
if (this.$store.state.user.roleId == 5) {
this.form.enterpriseId = this.enterpriseList[0].enterpriseId;
}
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
...@@ -502,13 +532,15 @@ export default { ...@@ -502,13 +532,15 @@ export default {
}, },
/** 详细信息跳转 */ /** 详细信息跳转 */
showDetail(row) { showDetail(row) {
this.reset2(); // this.reset2();
getEquipment(row.safeEquipmentId).then(response => { // getEquipment(row.safeEquipmentId).then(response => {
this.detailForm = response.data; // this.detailForm = response.data;
this.detailForm.equipments = this.detailForm.equipmentType.split(","); // this.detailForm.equipments = this.detailForm.equipmentType.split(",");
this.open2 = true; // this.open2 = true;
this.title2 = "用户加装安全装置台账详情"; // this.title2 = "用户加装安全装置台账详情";
}); // });
this.$refs.detail.getDetailInfo(row.safeEquipmentId);
}, },
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment