Przeglądaj źródła

企业信息添加删除校验
可视化接口增加查询条件
企业导出修改为正确的接口
企业资质文件和企业生产报告修改详情标题; 详情时禁止选择企业信息和文件类型,详情时隐藏确认按钮

Memory_LG 11 miesięcy temu
rodzic
commit
5df9d5d082

+ 4 - 4
data-ui/src/views/data/housingconstruction/enterprise/index.vue

@@ -133,7 +133,7 @@
 <!--          this.title === "修改企业信息"-->
           <el-col :span="12">
             <el-form-item label="企业" prop="id" v-if="title === '添加企业信息'">
-              <el-select v-model="form.id" placeholder="请选择企业" @change="handleEnterpriseChange">
+              <el-select v-model="form.id" placeholder="请选择企业">
                 <el-option
                   v-for="data in enterprisesList"
                   :key="data.deptId"
@@ -355,7 +355,7 @@ export default {
       console.log(this.form)
     },
     handleEnterpriseChange(newId) {
-      const selectedEnterprise = this.enterprisesList.find(item => item.deptId === newId);
+      const selectedEnterprise = this.enterprisesList.find(item => item.deptId == newId);
       if (selectedEnterprise) {
         this.form.enterpriseName = selectedEnterprise.deptName;
         this.form.longitude = selectedEnterprise.deptLongitude;
@@ -487,9 +487,9 @@ export default {
     },
     /** 提交按钮 */
     submitForm() {
-      console.log(this.$refs["form"])
       this.$refs["form"].validate(valid => {
         if (valid) {
+          this.handleEnterpriseChange(this.form.id)
           if (this.title === "修改企业信息") {
             updateEnterprise(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
@@ -520,7 +520,7 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      this.download('sooka-sponest-center-data/enterprise/export', {
+      this.download('sooka-sponest-center-data/housingconstruction/enterprise/export', {
         ...this.queryParams
       }, `企业信息_${format_date(new Date())}.xlsx`)
     }

+ 14 - 7
data-ui/src/views/data/housingconstruction/enterpriseproductionreport/index.vue

@@ -124,41 +124,44 @@
     <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body class="form-style">
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="所属企业" prop="enterpriseId">
-          <el-select v-model="form.enterpriseId" placeholder="请选择所属企业" @change="handleEnterpriseChange">
+          <el-select v-model="form.enterpriseId" placeholder="请选择所属企业" @change="handleEnterpriseChange" :disabled="isReadOnly">
             <el-option
               v-for="data in enterpriseList"
               :key="data.id"
               :label="data.enterpriseName"
               :value="data.id"
+              :readonly="isReadOnly"
             ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="报告类型" prop="reportType" v-if="this.$route.query.requestType === '1'">
-          <el-select v-model="form.reportType" placeholder="请选择报告类型">
+          <el-select v-model="form.reportType" placeholder="请选择报告类型" :disabled="isReadOnly">
             <el-option
               v-for="dict in dict.type.enterprise_production_report"
               :key="dict.value"
               :label="dict.label"
               :value="dict.value"
+              :readonly="isReadOnly"
             ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="文件类型" prop="reportType" v-if="this.$route.query.requestType === '2'">
-          <el-select v-model="form.reportType" placeholder="请选择文件类型">
+          <el-select v-model="form.reportType" placeholder="请选择文件类型" :disabled="isReadOnly">
             <el-option
               v-for="dict in dict.type.enterprise_qualification_file"
               :key="dict.value"
               :label="dict.label"
               :value="dict.value"
+              :readonly="isReadOnly"
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="附件" prop="fileUrl">
+        <el-form-item label="附件" prop="fileUrl" :disabled="isReadOnly">
           <fileUpload v-model="form.fileUrl" :setFileName="setFileName" :removeFileName="removeFileName"></fileUpload>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button type="primary" @click="submitForm" v-if="!isReadOnly">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
@@ -183,6 +186,8 @@ export default {
   dicts: ['enterprise_production_report', 'enterprise_qualification_file'],
   data() {
     return {
+      //详情只读
+      isReadOnly: false,
       // 遮罩层
       loading: true,
       // 选中数组
@@ -291,6 +296,7 @@ export default {
       };
       this.fileNames = [];
       this.resetForm("form");
+      this.isReadOnly = false;
     },
     /** 搜索按钮操作 */
     handleQuery() {
@@ -328,7 +334,8 @@ export default {
         }
         this.form = response.data;
         this.open = true;
-        this.title = "修改企业生产报告";
+        this.title = "详情";
+        this.isReadOnly = true
       });
     },
     /** 提交按钮 */
@@ -355,7 +362,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除企业生产报告编号为"' + ids + '"的数据项?').then(function () {
+      this.$modal.confirm('是否确认删除选中的数据项?').then(function () {
         return delEnterpriseproductionreport(ids);
       }).then(() => {
         this.getList();

+ 36 - 4
data-ui/src/views/data/housingconstruction/log/index.vue

@@ -79,10 +79,30 @@
     <el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center"/>
       <el-table-column label="储罐名称" align="center" prop="storagetankName"/>
-      <el-table-column label="液体液位" align="center" prop="level"/>
-      <el-table-column label="温度" align="center" prop="heat"/>
-      <el-table-column label="内部气压" align="center" prop="pressure"/>
-      <el-table-column label="周边可燃性气体泄漏" align="center" prop="gasLeak"/>
+      <el-table-column
+        label="液体液位"
+        align="center"
+        prop="level"
+        :formatter="formatLevel"
+      />
+      <el-table-column
+        label="温度"
+        align="center"
+        prop="heat"
+        :formatter="formatHeat"
+      />
+      <el-table-column
+        label="内部气压"
+        align="center"
+        prop="pressure"
+        :formatter="formatPressure"
+      />
+      <el-table-column
+        label="周边可燃性气体泄漏"
+        align="center"
+        prop="gasLeak"
+        :formatter="formatGasLeak"
+      />
       <el-table-column label="运行状态" align="center" prop="runState">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.yes_no" :value="scope.row.runState"/>
@@ -366,6 +386,18 @@ export default {
       this.download('sooka-sponest-center-data/log/export', {
         ...this.queryParams
       }, `储罐运营数据_${format_date(new Date())}xlsx`)
+    },
+    formatLevel(cellValue) {
+      return `${cellValue.level} m`;
+    },
+    formatHeat(cellValue) {
+      return `${cellValue.heat} ℃`;
+    },
+    formatPressure(cellValue) {
+      return `${cellValue.pressure} MPa`;
+    },
+    formatGasLeak(cellValue){
+      return `${cellValue.gasLeak} %LEL`;
     }
   }
 };

+ 6 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/controller/CenterdataTHousingconstructionEnterpriseController.java

@@ -10,11 +10,13 @@ import com.ruoyi.common.security.annotation.RequiresPermissions;
 import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionEnterprise;
 import com.sooka.sponest.data.housingconstruction.service.ICenterdataTHousingconstructionEnterpriseService;
 import com.sooka.sponest.data.utils.DataConstants;
+import org.apache.commons.collections4.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 住建-企业信息Controller
@@ -93,6 +95,10 @@ public class CenterdataTHousingconstructionEnterpriseController extends BaseCont
     @Log(title = "住建-企业信息", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable String[] ids) {
+        Map<String, Object> hasBind = centerdataTHousingconstructionEnterpriseService.hasBindByIds(ids);
+        if(MapUtils.getInteger(hasBind, "sum") > 0){
+            return AjaxResult.error("请先删除下级资源");
+        }
         return toAjax(centerdataTHousingconstructionEnterpriseService.deleteCenterdataTHousingconstructionEnterpriseByIds(ids));
     }
 

+ 2 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/mapper/CenterdataTHousingconstructionEnterpriseMapper.java

@@ -67,4 +67,6 @@ public interface CenterdataTHousingconstructionEnterpriseMapper {
     * @date 2024/8/5 上午11:21
     */
     List<Map<String,Object>> getEnterpriseList(CenterdataTHousingconstructionEnterprise enterprise);
+
+    Map<String, Object> hasBindByIds(String[] ids);
 }

+ 3 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/service/ICenterdataTHousingconstructionEnterpriseService.java

@@ -4,6 +4,7 @@ import com.sooka.sponest.data.base.service.IBaseService;
 import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionEnterprise;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 住建-企业信息Service接口
@@ -59,4 +60,6 @@ public interface ICenterdataTHousingconstructionEnterpriseService extends IBaseS
      * @return 结果
      */
     int deleteCenterdataTHousingconstructionEnterpriseById(String id);
+
+    Map<String, Object> hasBindByIds(String[] ids);
 }

+ 5 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/service/impl/CenterdataTHousingconstructionEnterpriseServiceImpl.java

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 住建-企业信息Service业务层处理
@@ -126,6 +127,10 @@ public class CenterdataTHousingconstructionEnterpriseServiceImpl extends BaseSer
         return centerdataTHousingconstructionEnterpriseMapper.deleteCenterdataTHousingconstructionEnterpriseById(id);
     }
 
+    @Override
+    public Map<String, Object> hasBindByIds(String[] ids) {
+        return centerdataTHousingconstructionEnterpriseMapper.hasBindByIds(ids);
+    }
 
     /*private void addDriviceList(List<String> driviceList, String id){
         if (StringUtils.isNotEmpty(driviceList)) {

+ 23 - 0
src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionEnterpriseMapper.xml

@@ -171,4 +171,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
          ${params.dataScope}
      </where>
     </select>
+
+    <select id="hasBindByIds" parameterType="String" resultType="map">
+        select IFNULL(sum(count),0) as sum FROM
+            (
+                select enterprise_id, COUNT(1) as count, 'gassource' as type FROM centerdata_t_housingconstruction_gassource GROUP BY enterprise_id
+                UNION
+                select enterprise_id, COUNT(1) as count, 'storagetank' as type FROM centerdata_t_housingconstruction_storagetank GROUP BY enterprise_id
+                UNION
+                select enterprise_id, COUNT(1) as count, 'steelcylinder' as type FROM centerdata_t_housingconstruction_steelcylinder GROUP BY enterprise_id
+                UNION
+                select enterprise_id, COUNT(1) as count, 'car' as type FROM centerdata_t_housingconstruction_car GROUP BY enterprise_id
+                UNION
+                select enterprise_id, COUNT(1) as count, 'realnameuser' as type FROM centerdata_t_housingconstruction_realnameuser GROUP BY enterprise_id
+                UNION
+                select enterprise_id, COUNT(1) as count, 'practitioner' as type FROM centerdata_t_housingconstruction_practitioner GROUP BY enterprise_id
+                UNION
+                select enterprise_id, COUNT(1) as count, 'personnel' as type FROM centerdata_t_housingconstruction_delivery_personnel GROUP BY enterprise_id
+            ) a
+        where enterprise_id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
 </mapper>

+ 23 - 22
src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionViewMapper.xml

@@ -6,11 +6,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="getGasCylinderList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
         select
-            sum(case when state='state_4' then 1 else 0 end) inUse,
-            sum(case when state!='state_4' then 1 else 0 end) toUse
+            IFNULL(sum( CASE WHEN state = 'state_4' THEN 1 ELSE 0 END ),0) inUse,
+            IFNULL(sum( CASE WHEN state != 'state_4' THEN 1 ELSE 0 END ),0) toUse
         from centerdata_t_housingconstruction_steelcylinder a
         LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
-        WHERE 1=1 ${params.dataScope}
+        <where>
+            <if test="enterpriseId != null and enterpriseId != ''">
+                and a.enterprise_id = #{enterpriseId}
+            </if>
+            ${params.dataScope}
+        </where>
     </select>
 
     <select id="getOrderList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
@@ -221,31 +226,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="getStoragetankList" parameterType="CenterdataTHousingconstructionStoragetank" resultType="map">
-        SELECT
+        select
             a.dept_id enterpriseId,
             a.dept_name enterpriseName,
-            a.storagetank_id storagetankId,
-            a.storagetank_name storagetankName,
-            a.level,
-            a.heat,
-            a.pressure,
-            a.gas_leak gasLeak,
-            a.security_state securityState,
-            a.run_state runState
-        FROM
-            centerdata_t_housingconstruction_storagetank_log a
-                left join centerdata_t_housingconstruction_storagetank b on a.storagetank_id = b.id
-                left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
-                JOIN (
-                SELECT storagetank_id,MAX(create_time) AS max_time
-                FROM centerdata_t_housingconstruction_storagetank_log
-                GROUP BY storagetank_id
-            ) b ON a.storagetank_id = b.storagetank_id AND a.create_time = b.max_time
+            a.id storagetankId,
+            a.name storagetankName,
+            IFNULL(b.LEVEL, '-') level,
+            IFNULL(b.heat,'-') heat,
+            IFNULL(b.pressure,'-') pressure,
+            IFNULL(b.gas_leak,'-') gasLeak,
+            IFNULL(b.security_state,'-') securityState,
+            IFNULL(b.run_state,'-') runState,
+            MAX(b.create_time)	as createTime
+        from centerdata_t_housingconstruction_storagetank a
+        LEFT JOIN  centerdata_t_housingconstruction_storagetank_log b  ON b.storagetank_id = a.id
+        LEFT JOIN ${database_system}.sys_dept d on a.dept_id = d.dept_id
         <where>
-            <if test="enterpriseId != null  and enterpriseId != ''"> and b.enterprise_id = #{enterpriseId}</if>
+            <if test="enterpriseId != null  and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
             <if test="state != null  and state != ''"> and a.security_state is not null</if>
             ${params.dataScope}
         </where>
+        GROUP BY a.id
     </select>
 
     <select id="getSteelcylinderStateList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">