Commit d65c0115 authored by zhangjianqian's avatar zhangjianqian

隐患台账修改

parent 378de7cf
package com.zehong.web.controller.hiddenDanger;
import java.util.List;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.utils.ServletUtils;
import com.zehong.framework.web.service.TokenService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -32,7 +37,8 @@ public class TStaningBookController extends BaseController
{
@Autowired
private ITStaningBookService tStaningBookService;
@Autowired
private TokenService tokenService;
/**
* 查询隐患台账列表
*/
......@@ -40,8 +46,10 @@ public class TStaningBookController extends BaseController
@GetMapping("/list")
public TableDataInfo list(TStaningBook tStaningBook)
{
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
startPage();
List<TStaningBook> list = tStaningBookService.selectTStaningBookList(tStaningBook);
List<TStaningBook> list = tStaningBookService.selectTStaningBookList(tStaningBook,user.getDeptId());
return getDataTable(list);
}
......@@ -53,7 +61,10 @@ public class TStaningBookController extends BaseController
@GetMapping("/export")
public AjaxResult export(TStaningBook tStaningBook)
{
List<TStaningBook> list = tStaningBookService.selectTStaningBookList(tStaningBook);
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
startPage();
List<TStaningBook> list = tStaningBookService.selectTStaningBookList(tStaningBook,user.getDeptId());
ExcelUtil<TStaningBook> util = new ExcelUtil<TStaningBook>(TStaningBook.class);
return util.exportExcel(list, "隐患台账数据");
}
......
package com.zehong.system.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -140,6 +142,17 @@ public class TStaningBook extends BaseEntity
/** 删除 0否 1是 */
private Integer isDel;
private List<Long> deptList;
public List<Long> getDeptList() {
return deptList;
}
public void setDeptList(List<Long> deptList) {
this.deptList = deptList;
}
public String getEscalationName() {
return escalationName;
}
......
......@@ -134,4 +134,7 @@ public interface SysDeptMapper
public List<Map<String,Object>> classification(Long deptId);
public List<Map<String,Object>> classificationByList(@Param("list") List<Map<String,Object>> list);
public List<Long> selectDeptByParentId(@Param("deptList") List<Long> deptList);
}
......@@ -27,7 +27,7 @@ public interface ITStaningBookService
* @param tStaningBook 隐患台账
* @return 隐患台账集合
*/
public List<TStaningBook> selectTStaningBookList(TStaningBook tStaningBook);
public List<TStaningBook> selectTStaningBookList(TStaningBook tStaningBook,Long deptId);
/**
* 新增隐患台账
......
package com.zehong.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -49,20 +50,23 @@ public class TStaningBookServiceImpl implements ITStaningBookService
* @return 隐患台账
*/
@Override
public List<TStaningBook> selectTStaningBookList(TStaningBook tStaningBook)
public List<TStaningBook> selectTStaningBookList(TStaningBook tStaningBook,Long deptId)
{
List<Long> oneList = new ArrayList<>();
oneList.add(deptId);
List<Long> deptIds = selectDeptIds(new ArrayList<>(),oneList);
tStaningBook.setDeptList(deptIds);
List<TStaningBook> list = tStaningBookMapper.selectTStaningBookList(tStaningBook);
// for(TStaningBook book: list){
// if(book.getDeptId()!=null){
// SysDept dept = deptMapper.selectDeptById(book.getDeptId());
// if(dept!=null){
// book.setDeptName(dept.getDeptName());
// }
// }
// }
return list;
return list;
}
public List<Long> selectDeptIds(List<Long> list,List<Long> deptIds){
List<Long> resultlist = deptMapper.selectDeptByParentId(deptIds);
if(resultlist.size()==0){
return list;
}
list.addAll(resultlist);
return selectDeptIds(list,resultlist);
}
/**
* 新增隐患台账
*
......
......@@ -193,4 +193,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
GROUP BY d.`dept_id`
</select>
<select id="selectDeptByParentId" resultType="java.lang.Long">
SELECT dept_id FROM sys_dept WHERE parent_id IN
<foreach collection="deptList" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</select>
</mapper>
\ No newline at end of file
......@@ -56,6 +56,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN t_staff s3 ON b.`person_liable` = s3.`staff_id`
LEFT JOIN sys_dept d ON d.`dept_id` = b.`dept_id`
<where>
AND s1.dept_id in
<foreach collection="deptList" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
<if test="troubleName != null and troubleName != ''"> and b.trouble_name like concat('%', #{troubleName}, '%')</if>
<if test="findTime != null "> and b.find_time &gt; #{findTime}</if>
<if test="rectificationTime != null "> and b.find_time &lt; #{rectificationTime}</if>
......
......@@ -104,7 +104,15 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:book:edit']"
>修改</el-button>
>整改</el-button>
<el-button
v-if="scope.row.state==1"
size="mini"
type="text"
icon="el-icon-edit"
@click="handlecha(scope.row)"
v-hasPermi="['system:book:edit']"
>复查</el-button>
<el-button
size="mini"
type="text"
......@@ -198,7 +206,7 @@
</el-row>
<!--<el-form-item label="现场照片" prop="picture">-->
<!--<el-input v-model="form.picture" placeholder="请输入现场照片" />-->
<!--<el-input v-model="form.picture" placeholder="请输入现场照片" />-->
<!--</el-form-item>-->
<el-form-item label="现场照片" v-if="!readOnly" prop="picture">
<MyFileUpload
......@@ -250,10 +258,10 @@
</el-form-item>
<!--<el-form-item label="投入费用" prop="investmentCost" v-if="zhong==1">-->
<!--<el-input v-model="form.investmentCost" placeholder="请输入投入费用" />-->
<!--<el-input v-model="form.investmentCost" placeholder="请输入投入费用" />-->
<!--</el-form-item>-->
<!--<el-form-item label="投入物资" prop="investmentMaterial" v-if="zhong==1">-->
<!--<el-input v-model="form.investmentMaterial" placeholder="请输入投入物资" />-->
<!--<el-input v-model="form.investmentMaterial" placeholder="请输入投入物资" />-->
<!--</el-form-item>-->
<el-form-item label="整改人" prop="rectification" v-if="zhong==2||fast">
<el-select v-model="form.rectification" filterable placeholder="请选择">
......@@ -303,10 +311,10 @@
<el-form-item label="复查时间" prop="inspectTime" v-if ="fast">
<el-date-picker clearable size="small"
v-model="form.inspectTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择复查时间">
v-model="form.inspectTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择复查时间">
</el-date-picker>
</el-form-item>
<el-form-item label="复查描述" prop="inspectResult" v-if ="fast">
......@@ -504,6 +512,205 @@
</el-form>
</el-dialog>
<!--整改复查-->
<el-dialog :title="title" :visible.sync="open3" width="900px" append-to-body>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="隐患名称" prop="troubleName">
<el-input v-model="form.troubleName" placeholder="请输入隐患名称" disabled/>
</el-form-item>
<el-row :gutter="24" class="mb8">
<el-col :span="12">
<el-form-item label="隐患类型" prop="troubleType" width="50%" >
<el-select v-model="form.troubleType" placeholder="请选择隐患类型" @change="changeType" disabled>
<el-option
v-for="dict in troubleTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="隐患等级" prop="troubleLevel">
<el-select v-model="form.troubleLevel" placeholder="请选择隐患等级" disabled>
<el-option
v-for="dict in troubleLevelOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="隐患描述" prop="measures">
<el-input v-model="form.measures" type="textarea" placeholder="请输入内容" disabled/>
</el-form-item>
<el-form-item label="隐患危害" prop="troubleHarm">
<el-input v-model="form.troubleHarm" placeholder="请输入隐患危害" disabled/>
</el-form-item>
<el-row :gutter="24" class="mb8">
<el-col :span="12">
<el-form-item label="上报人" prop="escalation">
<!--<el-input v-model="form.escalation" placeholder="请输入隐患上报人" />-->
<el-select v-model="form.escalation" filterable placeholder="请选择" disabled>
<el-option
v-for="item in staffList"
:key="item.staffId"
:label="item.staffName"
:value="item.staffId">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发现时间" prop="findTime" >
<el-date-picker clearable size="small" disabled
v-model="form.findTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择隐患上报时间">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<!--<el-form-item label="现场照片" prop="picture">-->
<!--<el-input v-model="form.picture" placeholder="请输入现场照片" />-->
<!--</el-form-item>-->
<el-form-item label="现场照片" v-if="!readOnly" prop="picture">
<img style="width: 150px;height: 150px" :src="form.picture">
</img>
</el-form-item>
<el-form-item label="隐患附件" prop="enclosure" v-if="zhong==1">
<!--<el-input v-model="form.enclosure" placeholder="请输入隐患附件" />-->
<FileUpload
listType="picture"
@resFun="getFileInfo($event,3)"
@remove="listRemove($event,3)"
:fileArr="fileList3"
/>
<el-input v-show="false" disabled v-model="form.enclosure"></el-input>
</el-form-item>
<el-row :gutter="24" class="mb8">
<el-col :span="12">
<el-form-item label="责任部门" prop="deptId">
<!--<el-input v-model="form.deptId" placeholder="请输入部门id" />-->
<el-select v-model="form.deptId" filterable placeholder="请选择责任部门" disabled>
<el-option
v-for="dict in deptList"
:key="dict.deptId"
:label="dict.deptName"
:value="parseInt(dict.deptId)"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="整改时限" prop="rectificationTerm">
<el-date-picker clearable size="small" disabled
v-model="form.rectificationTerm"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择整改时间">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="整改建议" prop="proposal">
<el-input type="textarea" v-model="form.proposal" placeholder="请输入整改建议" disabled/>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注" disabled/>
</el-form-item>
<!--<el-form-item label="投入费用" prop="investmentCost" v-if="zhong==1">-->
<!--<el-input v-model="form.investmentCost" placeholder="请输入投入费用" />-->
<!--</el-form-item>-->
<!--<el-form-item label="投入物资" prop="investmentMaterial" v-if="zhong==1">-->
<!--<el-input v-model="form.investmentMaterial" placeholder="请输入投入物资" />-->
<!--</el-form-item>-->
<el-form-item label="整改人" prop="rectification" >
<el-select v-model="form.rectification" filterable placeholder="请选择" :disabled="disabled">
<el-option
v-for="item in staffList"
:key="item.staffId"
:label="item.staffName"
:value="item.staffId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="整改图片" v-if="!disabled" prop="rectificationPictrue" >
<MyFileUpload
listType="picture-card"
@resFun="getFileInfo($event,1)"
@remove="listRemove($event,1)"
:fileArr="fileList1"
/>
<el-input v-show="false" disabled v-model="form.rectificationPictrue"></el-input>
</el-form-item>
<el-form-item label="整改照片" v-if="disabled" prop="picture">
<img style="width: 150px;height: 150px" :src="form.rectificationPictrue">
</img>
</el-form-item>
<el-form-item label="整改时间" prop="rectificationTime" >
<el-date-picker clearable size="small"
:disabled="disabled"
v-model="form.rectificationTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择复查时间">
</el-date-picker>
</el-form-item>
<el-form-item label="整改描述" prop="rectificationText" >
<el-input type="textarea" v-model="form.rectificationText" placeholder="请输入整改描述" :disabled="disabled" />
</el-form-item>
<el-form-item label="复查图片" v-if="disabled" prop="picture">
<MyFileUpload
listType="picture-card"
@resFun="getFileInfo($event,2)"
@remove="listRemove($event,2)"
:fileArr="fileList2"
/>
<el-input v-show="false" disabled v-model="form.inspectPictrue"></el-input>
</el-form-item>
<el-form-item label="复查时间" prop="inspectTime" v-if ="fast">
<el-date-picker clearable size="small"
v-model="form.inspectTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择复查时间">
</el-date-picker>
</el-form-item>
<el-form-item label="复查描述" prop="inspectResult" v-if="disabled">
<el-input type="textarea" v-model="form.inspectResult" placeholder="请输入复查结果描述" />
</el-form-item>
<el-form-item label="复查人" prop="personLiable" v-if="disabled">
<el-select v-model="form.personLiable" filterable placeholder="请选择">
<el-option
v-for="item in staffList"
:key="item.staffId"
:label="item.staffName"
:value="item.staffId">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -522,6 +729,8 @@ export default {
data() {
return {
readOnly:false,
disabled:false,
disabled2:false,
fast:false,
fileList:[],
fileList1:[],
......@@ -560,6 +769,7 @@ export default {
// 是否显示弹出层
open: false,
open2:false,
open3:false,
// 隐患类型字典
troubleTypeOptions: [],
// 隐患等级字典
......@@ -761,10 +971,44 @@ export default {
if (this.form.enclosure) {
this.fileList3 = [{name: 'file', url:uploadfile}];
}
this.open = true;
this.title = "修改隐患台账";
this.open3 = true;
this.title = "隐患台账整改";
});
},
/** 修改按钮操作 */
handlecha(row) {
this.reset();
const bookId = row.bookId || this.ids
getBook(bookId).then(response => {
this.form = response.data;
if(this.form.troubleType==2){
this.zhong = 1
}else{
this.zhong = 0
}
if (this.form.picture) {
this.fileList.push({
url: this.form.picture,
});
}
if (this.form.rectificationPictrue) {
this.fileList1.push({
url: this.form.rectificationPictrue,
});
}
if (this.form.inspectPictrue) {
this.fileList2.push({
url: this.form.inspectPictrue,
});
}
if (this.form.enclosure) {
this.fileList3 = [{name: 'file', url:uploadfile}];
}
this.open3 = true;
this.disabled = true;
this.title = "隐患台账复查";
});
},
handleDetail(row) {
this.reset();
const bookId = row.bookId || this.ids
......@@ -851,9 +1095,15 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.bookId != null) {
if(this.disabled){
this.form.state = 2;
}else {
this.form.state = 1;
}
updateBook(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.open3 = false;
this.getList();
});
} else {
......
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