77681 1 өдөр өмнө
parent
commit
523a4ab9fa

+ 25 - 1
gw-slaj/src/main/java/com/goldenwater/slaj/acci/controller/BisAcciMontController.java

@@ -13,6 +13,7 @@ import com.goldenwater.common.core.domain.AjaxResult;
 import com.goldenwater.common.core.page.TableDataInfo;
 import com.goldenwater.common.enums.BusinessType;
 import com.goldenwater.common.utils.poi.ExcelUtil;
+import com.goldenwater.common.utils.SecurityUtils;
 import com.goldenwater.slaj.acci.domain.BisAcciMont;
 import com.goldenwater.slaj.acci.domain.ObjAcci;
 import com.goldenwater.slaj.acci.service.IBisAcciMontService;
@@ -32,6 +33,7 @@ public class BisAcciMontController extends BaseController {
 
     @GetMapping("/list")
     public TableDataInfo list(BisAcciMont bisAcciMont) {
+        fillDataScope(bisAcciMont);
         startPage();
         List<BisAcciMont> list = bisAcciMontService.selectBisAcciMontList(bisAcciMont);
         return getDataTable(list);
@@ -80,6 +82,7 @@ public class BisAcciMontController extends BaseController {
     @PreAuthorize("@ss.hasPermi('acci:bisaccimont:export')")
     @PostMapping("/export")
     public void export(HttpServletResponse response, BisAcciMont bisAcciMont) {
+        fillDataScope(bisAcciMont);
         List<BisAcciMont> list = bisAcciMontService.selectBisAcciMontList(bisAcciMont);
         ExcelUtil<BisAcciMont> util = new ExcelUtil<BisAcciMont>(BisAcciMont.class);
         util.exportExcel(response, list, "事故月报数据");
@@ -172,7 +175,9 @@ public class BisAcciMontController extends BaseController {
      */
     @GetMapping("/treeData")
     public AjaxResult treeData() {
-        List<BisAcciMont> list = bisAcciMontService.selectBisAcciMontList(new BisAcciMont());
+        BisAcciMont query = new BisAcciMont();
+        fillDataScope(query);
+        List<BisAcciMont> list = bisAcciMontService.selectBisAcciMontList(query);
         List<Map<String, Object>> tree = new java.util.ArrayList<>();
         Calendar cal = Calendar.getInstance();
         int curYear = cal.get(Calendar.YEAR);
@@ -206,6 +211,7 @@ public class BisAcciMontController extends BaseController {
      */
     @GetMapping("/montSummary")
     public AjaxResult montSummary(BisAcciMont query) {
+        fillDataScope(query);
         List<BisAcciMont> list = bisAcciMontService.selectBisAcciMontList(query);
         Map<String, int[]> typeStats = new java.util.LinkedHashMap<>();
         typeStats.put("1", new int[]{0, 0});
@@ -276,4 +282,22 @@ public class BisAcciMontController extends BaseController {
         BisAcciMont mont = bisAcciMontService.selectBisAcciMontByGuid(guid);
         return AjaxResult.success(mont);
     }
+
+    /**
+     * 数据权限过滤 — 根据当前用户角色决定查询范围。
+     * 水利部(角色9)/管理员(角色1)看全部;其他角色只看本单位及下属单位数据。
+     */
+    private void fillDataScope(BisAcciMont vo) {
+        if (isAdmin()) return;
+        vo.setOrgGuid(getDeptId());
+    }
+
+    private boolean isAdmin() {
+        String[] roleIds = getLoginUser().getUser().getRoleIds();
+        if (roleIds == null) return false;
+        for (String roleId : roleIds) {
+            if ("1".equals(roleId) || "9".equals(roleId)) return true;
+        }
+        return false;
+    }
 }

+ 36 - 4
gw-slaj/src/main/java/com/goldenwater/slaj/acci/controller/ObjAcciController.java

@@ -12,6 +12,7 @@ import com.goldenwater.common.core.domain.AjaxResult;
 import com.goldenwater.common.core.page.TableDataInfo;
 import com.goldenwater.common.enums.BusinessType;
 import com.goldenwater.common.utils.poi.ExcelUtil;
+import com.goldenwater.common.utils.SecurityUtils;
 import com.goldenwater.slaj.acci.domain.BisAcciExpRep;
 import com.goldenwater.slaj.acci.domain.ObjAcci;
 import com.goldenwater.slaj.acci.domain.ObjAcciVo;
@@ -32,6 +33,7 @@ public class ObjAcciController extends BaseController {
 
     @GetMapping("/list")
     public TableDataInfo list(ObjAcciVo objAcciVo) {
+        fillDataScope(objAcciVo);
         startPage();
         List<ObjAcciVo> list = objAcciService.selectObjAcciList(objAcciVo);
         return getDataTable(list);
@@ -61,6 +63,7 @@ public class ObjAcciController extends BaseController {
     @PreAuthorize("@ss.hasPermi('acci:objacci:export')")
     @PostMapping("/export")
     public void export(HttpServletResponse response, ObjAcciVo objAcciVo) {
+        fillDataScope(objAcciVo);
         List<ObjAcciVo> list = objAcciService.selectObjAcciList(objAcciVo);
         ExcelUtil<ObjAcciVo> util = new ExcelUtil<ObjAcciVo>(ObjAcciVo.class);
         util.exportExcel(response, list, "事故对象数据");
@@ -104,6 +107,7 @@ public class ObjAcciController extends BaseController {
      */
     @GetMapping("/summary")
     public AjaxResult summary(ObjAcciVo objAcciVo) {
+        fillDataScope(objAcciVo);
         List<ObjAcciVo> all = objAcciService.selectObjAcciList(objAcciVo);
         int total = all.size();
         long general = all.stream().filter(a -> "1".equals(a.getAcciGrad())).count();
@@ -164,7 +168,9 @@ public class ObjAcciController extends BaseController {
      */
     @GetMapping("/reportProgress")
     public AjaxResult reportProgress() {
-        List<ObjAcciVo> all = objAcciService.selectObjAcciList(new ObjAcciVo());
+        ObjAcciVo query = new ObjAcciVo();
+        fillDataScope(query);
+        List<ObjAcciVo> all = objAcciService.selectObjAcciList(query);
         long total = all.size();
         long reported = all.stream().filter(a -> "2".equals(a.getRepStat())).count();
         Map<String, Object> result = new java.util.HashMap<>();
@@ -182,7 +188,9 @@ public class ObjAcciController extends BaseController {
      */
     @GetMapping("/todoList")
     public AjaxResult todoList() {
-        List<ObjAcciVo> todo = objAcciService.selectObjAcciList(new ObjAcciVo());
+        ObjAcciVo query = new ObjAcciVo();
+        fillDataScope(query);
+        List<ObjAcciVo> todo = objAcciService.selectObjAcciList(query);
         todo = todo.stream().filter(a -> a.getRepStat() == null || "0".equals(a.getRepStat())).limit(10).toList();
         return AjaxResult.success(todo);
     }
@@ -256,14 +264,38 @@ public class ObjAcciController extends BaseController {
      */
     @GetMapping("/statList")
     public TableDataInfo statList(@RequestParam(required = false) String orgNature,
-                                  @RequestParam(required = false) String beginTime,
-                                  @RequestParam(required = false) String endTime) {
+                                   @RequestParam(required = false) String beginTime,
+                                   @RequestParam(required = false) String endTime) {
         startPage();
         Map<String, Object> params = new java.util.HashMap<>();
         params.put("orgNature", orgNature);
         params.put("beginTime", beginTime);
         params.put("endTime", endTime);
+        fillStatDataScope(params);
         List<Map<String, Object>> list = objAcciService.selectAcciStatList(params);
         return getDataTable(list);
     }
+
+    /**
+     * 数据权限过滤 — 根据当前用户角色决定查询范围。
+     * 水利部(角色9)看全部;其他角色只看本单位数据。
+     */
+    private void fillDataScope(ObjAcciVo vo) {
+        if (isAdmin()) return;
+        vo.setOrgGuid(getDeptId());
+    }
+
+    private void fillStatDataScope(Map<String, Object> params) {
+        if (isAdmin()) return;
+        params.put("orgGuid", getDeptId());
+    }
+
+    private boolean isAdmin() {
+        String[] roleIds = getLoginUser().getUser().getRoleIds();
+        if (roleIds == null) return false;
+        for (String roleId : roleIds) {
+            if ("1".equals(roleId) || "9".equals(roleId)) return true;
+        }
+        return false;
+    }
 }

+ 2 - 0
gw-slaj/src/main/java/com/goldenwater/slaj/acci/domain/BisAcciMont.java

@@ -59,4 +59,6 @@ public class BisAcciMont {
     private String montStat;
     /** 锁定状态 (SQL计算: 0=未锁定 1=已锁定) */
     private String lockStatus;
+    /** 单位主键(数据权限过滤用) */
+    private String orgGuid;
 }

+ 2 - 0
gw-slaj/src/main/java/com/goldenwater/slaj/acci/domain/ObjAcciVo.java

@@ -22,4 +22,6 @@ public class ObjAcciVo extends ObjAcci {
     private String beginTime;
     private String endTime;
     private String orgName;
+    /** 单位主键(数据权限过滤用) */
+    private String orgGuid;
 }

+ 0 - 1
gw-slaj/src/main/java/com/goldenwater/slaj/hazard/controller/ObjHachController.java

@@ -26,7 +26,6 @@ public class ObjHachController extends BaseController {
 
     @GetMapping("/list")
     public TableDataInfo list(ObjHachVo objHachVo) {
-        objHachVo.setOrgGuid(getDeptId());
         startPage();
         List<ObjHachVo> list = objHachService.selectObjHachList(objHachVo);
         return getDataTable(list);

+ 0 - 1
gw-slaj/src/main/java/com/goldenwater/slaj/hazard/controller/ObjHazController.java

@@ -27,7 +27,6 @@ public class ObjHazController extends BaseController {
 
     @GetMapping("/list")
     public TableDataInfo list(ObjHazVo objHazVo) {
-        objHazVo.setOrgGuid(getDeptId());
         startPage();
         List<ObjHazVo> list = objHazService.selectObjHazList(objHazVo);
         return getDataTable(list);

+ 30 - 1
gw-slaj/src/main/resources/mapper/slaj/acci/BisAcciMontMapper.xml

@@ -44,7 +44,36 @@
         where guid = #{guid}
     </select>
     <select id="selectBisAcciMontList" parameterType="com.goldenwater.slaj.acci.domain.BisAcciMont" resultMap="BisAcciMontResult">
-        <include refid="selectBisAcciMontVo"/>
+        <choose>
+            <when test="orgGuid != null and orgGuid != ''">
+                WITH RECURSIVE subOrgs AS (
+                    SELECT guid, org_name FROM att_org_base WHERE guid = #{orgGuid}
+                    UNION ALL
+                    SELECT e.org_guid, o.org_name FROM att_org_ext e
+                    LEFT JOIN att_org_base o ON o.guid = e.org_guid
+                    WHERE e.admin_wiun_guid = #{orgGuid}
+                    UNION ALL
+                    SELECT b.guid, b.org_name FROM att_org_base b
+                    INNER JOIN subOrgs s ON b.pguid = s.guid
+                )
+                select m.guid, m.rep_wiun_code, m.acci_cate, m.acci_grad, m.occu_time, m.cas_num,
+                       m.ser_inj_num, m.econ_loss, m.rep_act, m.note, m.acci_result, m.monthly_audit,
+                       m.monthly_audit_result, m.returninfo, m.revocation_audit,
+                       m.revocation_audit_result, m.coll_time, m.upd_time, m.rec_pers, m.acci_wiun_type,
+                       to_char(m.occu_time, 'yyyy-MM') as mont,
+                       case when m.monthly_audit_result = '1' then '2'
+                            when m.monthly_audit_result = '0' then '3'
+                            when m.rep_act is not null and m.rep_act != '' then '1'
+                       else '0' end as mont_stat,
+                       case when m.monthly_audit_result is not null then '1' else '0' end as lock_status
+                from bis_acci_mont m
+                inner join att_org_base o on m.rep_wiun_code = o.org_name
+                inner join subOrgs s on o.guid = s.guid
+            </when>
+            <otherwise>
+                <include refid="selectBisAcciMontVo"/>
+            </otherwise>
+        </choose>
         <where>
             <if test="guid != null and guid != ''">AND guid = #{guid}</if>
             <if test="repWiunCode != null and repWiunCode != ''">AND rep_wiun_code = #{repWiunCode}</if>

+ 71 - 21
gw-slaj/src/main/resources/mapper/slaj/acci/ObjAcciMapper.xml

@@ -50,16 +50,43 @@
         where a.guid = #{guid}
     </select>
     <select id="selectObjAcciList" parameterType="com.goldenwater.slaj.acci.domain.ObjAcciVo" resultMap="ObjAcciResult">
-        select a.guid, a.p_guid, a.acci_wiun_guid, a.acci_wiun_type, a.acci_cate, a.occu_time,
-               a.occu_loc, a.miss_num, a.ser_inj_num, a.cas_num, a.econ_loss, a.otlcol_guui_vicm,
-               a.resc_trea_meas, a.conta_pers, a.offi_tel, a.rep_stat, a.note, a.coll_time,
-               a.        upd_time, a.rec_pers, a.sgdw_name, a.acci_grad, a.eng_guid, a.to_date, a.tend_guid,
-               a.sgdw_name || '事故' as acci_name,
-               e.eng_name, t.tend_name, bi.if_resp_acci as if_duty, bi.if_pho_rep as if_phone, bi.acci_cause
-        from obj_acci a
-        left join att_eng_base e on a.eng_guid = e.guid
-        left join obj_tend t on a.tend_guid = t.guid
-        left join bis_acci_inve bi on a.guid = bi.acci_guid
+        <choose>
+            <when test="orgGuid != null and orgGuid != ''">
+                WITH RECURSIVE subOrgs AS (
+                    SELECT guid, org_name FROM att_org_base WHERE guid = #{orgGuid}
+                    UNION ALL
+                    SELECT e.org_guid, o.org_name FROM att_org_ext e
+                    LEFT JOIN att_org_base o ON o.guid = e.org_guid
+                    WHERE e.admin_wiun_guid = #{orgGuid}
+                    UNION ALL
+                    SELECT b.guid, b.org_name FROM att_org_base b
+                    INNER JOIN subOrgs s ON b.pguid = s.guid
+                )
+                select a.guid, a.p_guid, a.acci_wiun_guid, a.acci_wiun_type, a.acci_cate, a.occu_time,
+                       a.occu_loc, a.miss_num, a.ser_inj_num, a.cas_num, a.econ_loss, a.otlcol_guui_vicm,
+                       a.resc_trea_meas, a.conta_pers, a.offi_tel, a.rep_stat, a.note, a.coll_time,
+                       a.upd_time, a.rec_pers, a.sgdw_name, a.acci_grad, a.eng_guid, a.to_date, a.tend_guid,
+                       a.sgdw_name || '事故' as acci_name,
+                       e.eng_name, t.tend_name, bi.if_resp_acci as if_duty, bi.if_pho_rep as if_phone, bi.acci_cause
+                from obj_acci a
+                inner join subOrgs s on a.acci_wiun_guid = s.guid
+                left join att_eng_base e on a.eng_guid = e.guid
+                left join obj_tend t on a.tend_guid = t.guid
+                left join bis_acci_inve bi on a.guid = bi.acci_guid
+            </when>
+            <otherwise>
+                select a.guid, a.p_guid, a.acci_wiun_guid, a.acci_wiun_type, a.acci_cate, a.occu_time,
+                       a.occu_loc, a.miss_num, a.ser_inj_num, a.cas_num, a.econ_loss, a.otlcol_guui_vicm,
+                       a.resc_trea_meas, a.conta_pers, a.offi_tel, a.rep_stat, a.note, a.coll_time,
+                       a.upd_time, a.rec_pers, a.sgdw_name, a.acci_grad, a.eng_guid, a.to_date, a.tend_guid,
+                       a.sgdw_name || '事故' as acci_name,
+                       e.eng_name, t.tend_name, bi.if_resp_acci as if_duty, bi.if_pho_rep as if_phone, bi.acci_cause
+                from obj_acci a
+                left join att_eng_base e on a.eng_guid = e.guid
+                left join obj_tend t on a.tend_guid = t.guid
+                left join bis_acci_inve bi on a.guid = bi.acci_guid
+            </otherwise>
+        </choose>
         <where>
             <if test="guid != null and guid != ''">AND a.guid = #{guid}</if>
             <if test="acciGrad != null and acciGrad != ''">AND a.acci_grad = #{acciGrad}</if>
@@ -68,7 +95,6 @@
             <if test="ifDuty != null and ifDuty != ''">AND bi.if_resp_acci = #{ifDuty}</if>
             <if test="orgName != null and orgName != ''">AND a.sgdw_name like '%' || #{orgName} || '%'</if>
             <if test="sgdwName != null and sgdwName != ''">AND a.sgdw_name like '%' || #{sgdwName} || '%'</if>
-            <if test="acciGrad != null and acciGrad != ''">AND a.acci_grad = #{acciGrad}</if>
             <if test="engGuid != null and engGuid != ''">AND a.eng_guid = #{engGuid}</if>
             <if test="recPers != null and recPers != ''">AND a.rec_pers = #{recPers}</if>
         </where>
@@ -178,21 +204,45 @@
     </select>
 
     <select id="selectAcciStatList" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
-        select sgdw_name as orgName,
-               count(1) as acciCount,
-               sum(cast(coalesce(cas_num, '0') as numeric)) as deathCount,
-               sum(cast(coalesce(ser_inj_num, '0') as numeric)) as injuryCount,
-               sum(cast(coalesce(econ_loss, '0') as numeric)) as econLoss,
-               round(cast(sum(cast(coalesce(cas_num, '0') as numeric)) / count(1) as numeric), 2) as avgDeath,
-               round(cast(sum(cast(coalesce(ser_inj_num, '0') as numeric)) / count(1) as numeric), 2) as avgInjury,
-               round(cast(sum(cast(coalesce(econ_loss, '0') as numeric)) / count(1) as numeric), 2) as avgEconLoss
-        from obj_acci
+        <choose>
+            <when test="orgGuid != null and orgGuid != ''">
+                WITH RECURSIVE subOrgs AS (
+                    SELECT guid FROM att_org_base WHERE guid = #{orgGuid}
+                    UNION ALL
+                    SELECT e.org_guid FROM att_org_ext e WHERE e.admin_wiun_guid = #{orgGuid}
+                    UNION ALL
+                    SELECT b.guid FROM att_org_base b INNER JOIN subOrgs s ON b.pguid = s.guid
+                )
+                select sgdw_name as orgname,
+                       count(1) as accicount,
+                       sum(cast(coalesce(cas_num, '0') as numeric)) as deathcount,
+                       sum(cast(coalesce(ser_inj_num, '0') as numeric)) as injurycount,
+                       sum(cast(coalesce(econ_loss, '0') as numeric)) as econloss,
+                       round(cast(sum(cast(coalesce(cas_num, '0') as numeric)) / count(1) as numeric), 2) as avgdeath,
+                       round(cast(sum(cast(coalesce(ser_inj_num, '0') as numeric)) / count(1) as numeric), 2) as avginjury,
+                       round(cast(sum(cast(coalesce(econ_loss, '0') as numeric)) / count(1) as numeric), 2) as avgeconloss
+                from obj_acci
+            </when>
+            <otherwise>
+                select sgdw_name as orgname,
+                       count(1) as accicount,
+                       sum(cast(coalesce(cas_num, '0') as numeric)) as deathcount,
+                       sum(cast(coalesce(ser_inj_num, '0') as numeric)) as injurycount,
+                       sum(cast(coalesce(econ_loss, '0') as numeric)) as econloss,
+                       round(cast(sum(cast(coalesce(cas_num, '0') as numeric)) / count(1) as numeric), 2) as avgdeath,
+                       round(cast(sum(cast(coalesce(ser_inj_num, '0') as numeric)) / count(1) as numeric), 2) as avginjury,
+                       round(cast(sum(cast(coalesce(econ_loss, '0') as numeric)) / count(1) as numeric), 2) as avgeconloss
+                from obj_acci
+                where 1=1
+            </otherwise>
+        </choose>
         <where>
             <if test="orgNature != null and orgNature != ''">AND acci_wiun_type = #{orgNature}</if>
             <if test="beginTime != null and beginTime != ''">AND occu_time &gt;= #{beginTime}</if>
             <if test="endTime != null and endTime != ''">AND occu_time &lt;= #{endTime}</if>
+            <if test="orgGuid != null and orgGuid != ''">AND acci_wiun_guid in (select guid from subOrgs)</if>
         </where>
         group by sgdw_name
-        order by acciCount desc
+        order by accicount desc
     </select>
 </mapper>

+ 35 - 1
gw-slaj/src/main/resources/mapper/slaj/hidd/ObjHiddMapper.xml

@@ -78,7 +78,41 @@
             <if test="hiddName != null and hiddName != ''">AND h.hidd_name like '%' || #{hiddName}::text || '%'</if>
             <if test="hiddGrad != null and hiddGrad != ''">AND h.hidd_grad = #{hiddGrad}::text</if>
             <if test="hiddStat != null and hiddStat != ''">AND h.hidd_stat = #{hiddStat}::text</if>
-            <if test="orgGuid != null and orgGuid != ''">AND h.org_guid = #{orgGuid}::text</if>
+            <if test="orgGuid != null and orgGuid != ''">
+                <choose>
+                    <!-- consEng(7)/partEng(6): 两角度归并 - 自己的 + 关联施工单位/参建单位的 -->
+                    <when test="wiunProp == '6'.toString() or wiunProp == '7'.toString()">
+                        AND (
+                            h.org_guid = #{orgGuid}::text
+                            OR h.org_guid IN (
+                                -- 关联单位: rel_tend_org(标段关联) → att_org_uwat_base → org_code → att_org_base
+                                select b.guid from att_org_base b
+                                where b.org_code in (
+                                    select u.org_code from att_org_uwat_base u
+                                    where u.guid in (
+                                        select r.org_uwat_guid from rel_tend_org r
+                                        join obj_tend t on t.guid = r.tend_guid
+                                        where t.eng_guid in (
+                                            -- 当前用户(法人)的工程: att_eng_base.org_guid
+                                            select e.eng_guid from att_eng_base e where e.org_guid = #{orgGuid}::text
+                                            union
+                                            -- 当前用户(监理/施工)经标段关联的工程
+                                            select t2.eng_guid from obj_tend t2
+                                            where t2.guid in (
+                                                select r2.tend_guid from rel_tend_org r2
+                                                where r2.org_uwat_guid = #{orgGuid}::text
+                                            )
+                                        )
+                                    )
+                                )
+                            )
+                        )
+                    </when>
+                    <otherwise>
+                        AND h.org_guid = #{orgGuid}::text
+                    </otherwise>
+                </choose>
+            </if>
             <if test="engGuid != null and engGuid != ''">AND h.eng_guid = #{engGuid}::text</if>
             <if test="guid != null and guid != ''">AND h.guid = #{guid}::text</if>
             <if test="hiddSour != null and hiddSour != ''">AND h.hidd_sour = #{hiddSour}::text</if>

+ 24 - 0
gw-ui/src/utils/acci.js

@@ -0,0 +1,24 @@
+// 补报记录(BIS_ACCI_EXP_REP)表结构只有 note/rep_time 字段,
+// 补报明细(重伤/死亡/经济损失/事故描述)以 JSON 字符串存储在 note 中。
+// 解析 note 回填到行对象上,兼容旧数据的纯文本备注。
+export function parseExpRepFields(row) {
+  if (!row || !row.note) return row
+  let merged = null
+  for (const part of String(row.note).split(' | ')) {
+    try {
+      const obj = JSON.parse(part)
+      if (obj && typeof obj === 'object' && !Array.isArray(obj)) {
+        merged = { ...merged, ...obj }
+      }
+    } catch (e) { /* 兼容旧数据纯文本备注 */ }
+  }
+  if (merged) {
+    row.serInjNum = merged.serInjNum ?? ''
+    row.casNum = merged.casNum ?? ''
+    row.econLoss = merged.econLoss ?? ''
+    row.acciDesc = merged.acciDesc ?? ''
+  } else {
+    row.acciDesc = row.acciDesc || row.note
+  }
+  return row
+}

+ 2 - 1
gw-ui/src/views/slaj/acci/fastQuery.vue

@@ -114,6 +114,7 @@
 <script setup name="AcciFastQuery">
 import { Search, RefreshRight, Download, List } from '@element-plus/icons-vue'
 import { listObjAcci, listBisAcciExpRep } from "@/api/slaj/acci"
+import { parseExpRepFields } from "@/utils/acci"
 
 const { proxy } = getCurrentInstance()
 const { acci_grad, acci_cate } = proxy.useDict("acci_grad", "acci_cate")
@@ -190,7 +191,7 @@ function handleDetail(row) {
 function loadSuppList() {
   detailLoading.value = true
   listBisAcciExpRep({ acciGuid: detailForm.value.guid, pageNum: suppQuery.pageNum, pageSize: suppQuery.pageSize }).then(res => {
-    suppList.value = res.rows || []
+    suppList.value = (res.rows || []).map(r => parseExpRepFields(r))
     suppTotal.value = res.total || 0
   }).finally(() => { detailLoading.value = false })
 }

+ 1 - 1
gw-ui/src/views/slaj/acci/index.vue

@@ -8,7 +8,7 @@
             <span class="page-title">事故管理</span>
           </div>
           <div class="search-right">
-            <el-button type="warning" plain @click="handleExport"><el-icon><Download /></el-icon> 导出</el-button>
+            <el-button type="warning" plain @click="handleExport" v-hasPermi="['acci:objacci:export']"><el-icon><Download /></el-icon> 导出</el-button>
           </div>
         </div>
       </template>

+ 23 - 10
gw-ui/src/views/slaj/acci/manage.vue

@@ -90,7 +90,7 @@
               </el-form-item>
               <el-form-item>
                 <el-button type="primary" @click="handleQuery2"><el-icon><Search /></el-icon> 搜索</el-button>
-                <el-button :type="queryParams2.ifDuty ? 'danger' : ''" @click="filterDuty">{{ queryParams2.ifDuty ? '显示全部' : '剔除非责任事故' }}</el-button>
+                <el-button :type="queryParams2.ifDuty ? 'danger' : ''" @click="filterDuty" v-hasPermi="['acci:month:removeNonResp']">{{ queryParams2.ifDuty ? '显示全部' : '剔除非责任事故' }}</el-button>
               </el-form-item>
             </el-form>
           </div>
@@ -578,6 +578,7 @@ import { Search, RefreshRight, Plus, Download, Delete, Edit, WarningFilled } fro
 import { listObjAcci, compoundSaveAcci, delObjAcci, fastReportAcci } from "@/api/slaj/acci"
 import { listBisAcciExpRep, addBisAcciExpRep, updateBisAcciExpRep, delBisAcciExpRep } from "@/api/slaj/acci"
 import { getToken } from "@/utils/auth"
+import { parseExpRepFields } from "@/utils/acci"
 
 const { proxy } = getCurrentInstance()
 const { acci_grad } = proxy.useDict("acci_grad")
@@ -605,7 +606,7 @@ const suppTotal = ref(0); const suppQuery = reactive({ pageNum: 1, pageSize: 10
 const suppFormOpen = ref(false); const suppForm = ref({}); const suppFormRef = ref(null)
 
 const monthFormOpen = ref(false); const monthFormTitle = ref(''); const monthForm = ref({}); const monthFormRef = ref(null)
-const monthProgList = ref([]); const monthFileList = ref([]); const monthFormTab = ref('basic')
+const monthProgList = ref([]); const monthFileList = ref([])
 
 const suppMonthOpen = ref(false); const suppMonthAcciGuid = ref('')
 const suppMonthList = ref([]); const suppMonthIds = ref([]); const suppMonthMultiple = ref(true)
@@ -614,7 +615,7 @@ const suppMonthFormOpen = ref(false); const suppMonthForm = ref({}); const suppM
 
 const uploadUrl = import.meta.env.VITE_APP_BASE_API + '/common/upload'
 const uploadHeaders = { Authorization: 'Bearer ' + getToken() }
-const list2 = ref([]); const total2 = ref(0)
+const list2 = ref([]); const total2 = ref(0); const ids2 = ref([]); const multiple2 = ref(true)
 const list3 = ref([]); const total3 = ref(0)
 const list4 = ref([]); const total4 = ref(0)
 const list5 = ref([]); const total5 = ref(0)
@@ -688,7 +689,8 @@ function handleSupplement(row) {
 }
 function loadSuppMonthList() {
   listBisAcciExpRep({ acciGuid: suppMonthAcciGuid.value, pageNum: suppMonthQuery.pageNum, pageSize: suppMonthQuery.pageSize }).then(res => {
-    suppMonthList.value = res.rows || []; suppMonthTotal.value = res.total || 0
+    suppMonthList.value = (res.rows || []).map(r => parseExpRepFields(r))
+    suppMonthTotal.value = res.total || 0
   })
 }
 function handleSuppMonthSelect(s) { suppMonthIds.value = s.map(i => i.guid); suppMonthMultiple.value = !s.length }
@@ -706,7 +708,13 @@ function handleSuppMonthDelete(row) {
 function submitSuppMonthForm() {
   suppMonthFormRef.value.validate(valid => {
     if (!valid) return
-    addBisAcciExpRep({ ...suppMonthForm.value, acciGuid: suppMonthAcciGuid.value }).then(() => {
+    const note = JSON.stringify({
+      serInjNum: suppMonthForm.value.serInjNum || '',
+      casNum: suppMonthForm.value.casNum || '',
+      econLoss: suppMonthForm.value.econLoss || '',
+      acciDesc: suppMonthForm.value.acciDesc || ''
+    })
+    addBisAcciExpRep({ repTime: suppMonthForm.value.repTime, note: note, acciGuid: suppMonthAcciGuid.value }).then(() => {
       proxy.$modal.msgSuccess('保存成功')
       suppMonthFormOpen.value = false
       loadSuppMonthList()
@@ -715,7 +723,8 @@ function submitSuppMonthForm() {
 }
 function loadSuppList() {
   listBisAcciExpRep({ acciGuid: suppAcciGuid.value, pageNum: suppQuery.pageNum, pageSize: suppQuery.pageSize }).then(res => {
-    suppList.value = res.rows || []; suppTotal.value = res.total || 0
+    suppList.value = (res.rows || []).map(r => parseExpRepFields(r))
+    suppTotal.value = res.total || 0
   })
 }
 function handleSuppSelect(s) { suppIds.value = s.map(i => i.guid); suppMultiple.value = !s.length }
@@ -724,7 +733,7 @@ function handleSuppAdd() {
   suppFormOpen.value = true
 }
 function handleSuppUpdate(row) {
-  suppForm.value = { ...row }
+  suppForm.value = parseExpRepFields({ ...row })
   suppFormOpen.value = true
 }
 function handleSuppDelete(row) {
@@ -737,9 +746,13 @@ function handleSuppDelete(row) {
 function submitSuppForm() {
   suppFormRef.value.validate(valid => {
     if (!valid) return
+    const note = JSON.stringify({
+      serInjNum: suppForm.value.serInjNum || '',
+      casNum: suppForm.value.casNum || '',
+      econLoss: suppForm.value.econLoss || '',
+      acciDesc: suppForm.value.acciDesc || ''
+    })
     const api = suppForm.value.guid ? updateBisAcciExpRep : addBisAcciExpRep
-    const extra = { serInjNum: suppForm.value.serInjNum, casNum: suppForm.value.casNum, econLoss: suppForm.value.econLoss, acciDesc: suppForm.value.acciDesc }
-    const note = suppForm.value.note ? suppForm.value.note + ' | ' + JSON.stringify(extra) : JSON.stringify(extra)
     api({ guid: suppForm.value.guid, repTime: suppForm.value.repTime, note: note, acciGuid: suppAcciGuid.value }).then(() => {
       proxy.$modal.msgSuccess('保存成功')
       suppFormOpen.value = false
@@ -758,7 +771,7 @@ function handleExport2() { proxy.download("acci/objacci/export", queryParams2, `
 function handleAdd2() {
   monthFormTitle.value = '事故月报新增'
   monthForm.value = { sgdwName: '', engName: '', acciWiunType: '', acciCate: '', occuTime: '', serInjNum: '', casNum: '', econLoss: '', acciGrad: '', otlcolGuuiVicm: '', ifDuty: '', ifPhone: '' }
-  monthProgList.value = []; monthFileList.value = []; monthFormTab.value = 'basic'
+  monthProgList.value = []; monthFileList.value = []
   monthFormOpen.value = true
 }
 function handleUpdate2(row) {

+ 13 - 3
gw-ui/src/views/slaj/hazard/manage.vue

@@ -493,6 +493,11 @@ function hasTabPermi2(name) {
 }
 const activeTab = ref(Object.keys(tabPermiMap2).find(k => hasTabPermi2(k)) || 'eng')
 
+// 判断当前用户是否为施工单位(wiunProp='7')
+function isConsOrg() {
+  return proxy.$auth.hasPermi('hazar:tend:edit') && !proxy.$auth.hasPermi('hazar:tend:report')
+}
+
 function canDelete(row) {
   if (activeTab.value === 'tend') {
     if (proxy.$auth.hasPermi('hazar:tend:remove')) return true
@@ -535,20 +540,25 @@ const queryParams3 = reactive({ pageNum: 1, pageSize: 10, hachName: undefined, o
 
 function getList() {
   loading.value = true
-  listObjHaz({ ...queryParams }).then(res => {
+  listObjHaz({ ...queryParams, orgGuid: userStore.orgGuid || undefined }).then(res => {
     list.value = res.rows || []; total.value = res.total || 0; loading.value = false
   }).catch(() => { loading.value = false })
 }
 function getList2() {
   loading2.value = true
-  listObjHaz({ ...queryParams2 }).then(res => {
+  const params = { ...queryParams2 }
+  // 施工单位只看自己的,法人/监理看所有
+  if (isConsOrg()) {
+    params.orgGuid = userStore.orgGuid || undefined
+  }
+  listObjHaz(params).then(res => {
     list2.value = res.rows || []; total2.value = res.total || 0; loading2.value = false
   }).catch(() => { loading2.value = false })
 }
 function handleSelectionChange2(selection) { ids2.value = selection.map(item => item.guid); single2.value = selection.length !== 1; multiple2.value = !selection.length }
 function getList3() {
   loading3.value = true
-  listObjHach({ ...queryParams3 }).then(res => {
+  listObjHach({ ...queryParams3, orgGuid: userStore.orgGuid || undefined }).then(res => {
     list3.value = res.rows || []; total3.value = res.total || 0; loading3.value = false
   }).catch(() => { loading3.value = false })
 }

+ 2 - 2
gw-ui/src/views/slaj/hidd/monthDetail.vue

@@ -373,8 +373,8 @@ function loadHiddList() {
   hiddList.value = []
 
   if (isAddMode.value) {
-    // 新增模式:加载所有隐患
-    listObjHidd({}).then(res => {
+    // 新增模式:只加载当前用户单位的隐患
+    listObjHidd({ orgGuid: userStore.orgGuid || undefined }).then(res => {
       const allData = res.rows || res.data || []
       hiddTotal.value = allData.length
       const start = (hiddQueryParams.value.pageNum - 1) * hiddQueryParams.value.pageSize

+ 4 - 4
gw-ui/src/views/slaj/hidd/orgEngQuery.vue

@@ -1065,7 +1065,7 @@ const queryParams5 = reactive({ pageNum: 1, pageSize: 10, hiddName: undefined, o
 
 function getList4() {
   loading4.value = true
-  listObjHidd({ ...queryParams4, pageNum: queryParams4.pageNum, pageSize: queryParams4.pageSize, wiunProp: '7' }).then(res => {
+  listObjHidd({ ...queryParams4, pageNum: queryParams4.pageNum, pageSize: queryParams4.pageSize, wiunProp: '7', orgGuid: userStore.orgGuid || undefined }).then(res => {
     list4.value = res.rows || []
     total4.value = res.total || 0
     loading4.value = false
@@ -1105,7 +1105,7 @@ function handleDelete4(row) {
 }
 function handleSelectionChange4(selection) { ids4.value = selection.map(item => item.guid); single4.value = selection.length !== 1; multiple4.value = !selection.length }
 function handleQuery4() { queryParams4.pageNum = 1; getList4() }
-function handleExport4() { const { pageNum, pageSize, ...f } = queryParams4; proxy.download("hidd/objhidd/export", { ...f, wiunProp: '7' }, `施工单位隐患_${new Date().getTime()}.xlsx`) }
+function handleExport4() { const { pageNum, pageSize, ...f } = queryParams4; proxy.download("hidd/objhidd/export", { ...f, wiunProp: '7', orgGuid: userStore.orgGuid || undefined }, `施工单位隐患_${new Date().getTime()}.xlsx`) }
 function getList2() {
   loading2.value = true
   listNextDepHidd({ ...queryParams2, pageNum: queryParams2.pageNum, pageSize: queryParams2.pageSize, orgGuid: userStore.orgGuid || undefined }).then(res => {
@@ -1124,7 +1124,7 @@ function getList3() {
 }
 function getList5() {
   loading5.value = true
-  listObjHidd({ ...queryParams5, pageNum: queryParams5.pageNum, pageSize: queryParams5.pageSize, wiunProp: '6' }).then(res => {
+  listObjHidd({ ...queryParams5, pageNum: queryParams5.pageNum, pageSize: queryParams5.pageSize, wiunProp: '6', orgGuid: userStore.orgGuid || undefined }).then(res => {
     list5.value = res.rows || []
     total5.value = res.total || 0
     loading5.value = false
@@ -1161,7 +1161,7 @@ function handleDelete5(row) {
 }
 function handleSelectionChange5(selection) { ids5.value = selection.map(item => item.guid); single5.value = selection.length !== 1; multiple5.value = !selection.length }
 function handleQuery5() { queryParams5.pageNum = 1; getList5() }
-function handleExport5() { const { pageNum, pageSize, ...f } = queryParams5; proxy.download("hidd/objhidd/export", { ...f, wiunProp: '6' }, `参建单位隐患_${new Date().getTime()}.xlsx`) }
+function handleExport5() { const { pageNum, pageSize, ...f } = queryParams5; proxy.download("hidd/objhidd/export", { ...f, wiunProp: '6', orgGuid: userStore.orgGuid || undefined }, `参建单位隐患_${new Date().getTime()}.xlsx`) }
 function handleQuery2() { queryParams2.pageNum = 1; getList2() }
 function handleQuery3() { queryParams3.pageNum = 1; getList3() }
 function handleSelectionChange3(selection) { ids3.value = selection.map(item => item.guid); single3.value = selection.length !== 1; multiple3.value = !selection.length }