Explorar el Código

LY byx 批文

ly hace 2 años
padre
commit
1d05efa03c

+ 11 - 11
master/src/main/java/com/ruoyi/project/ehs/controller/TEnvironapprovalController.java

@@ -277,17 +277,17 @@ public class TEnvironapprovalController extends BaseController
         if (!file.isEmpty())
         {
             String url = FileUploadUtils.upload(RuoYiConfig.getFilePath("/"+ pType), file);
-            TEnvironapproval environapproval = tEnvironapprovalService.selectTEnvironapprovalById(Long.parseLong(pId));
-            if (pType.equals("requirementsWaterPic")) {
-                environapproval.setReqWater(url);
-            }else if (pType.equals("requirementsExhaustPic")) {
-                environapproval.setReqExhaust(url);
-            }else if (pType.equals("contentWaterPic")) {
-                environapproval.setConWater(url);
-            }else if (pType.equals("contentExhaustPic")) {
-                environapproval.setConExhaust(url);
-            }
-            tEnvironapprovalService.updateTEnvironapproval(environapproval);
+//            TEnvironapproval environapproval = tEnvironapprovalService.selectTEnvironapprovalById(Long.parseLong(pId));
+//            if (pType.equals("requirementsWaterPic")) {
+//                environapproval.setReqWater(url);
+//            }else if (pType.equals("requirementsExhaustPic")) {
+//                environapproval.setReqExhaust(url);
+//            }else if (pType.equals("contentWaterPic")) {
+//                environapproval.setConWater(url);
+//            }else if (pType.equals("contentExhaustPic")) {
+//                environapproval.setConExhaust(url);
+//            }
+//            tEnvironapprovalService.updateTEnvironapproval(environapproval);
             return AjaxResult.success(url);
         }
         return AjaxResult.error("上传失败,请联系管理员");

+ 17 - 0
master/src/main/java/com/ruoyi/project/ehs/controller/TSafetyapprovalController.java

@@ -9,6 +9,9 @@ import java.util.List;
 import com.alibaba.fastjson.JSON;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.file.ExcelUtils;
+import com.ruoyi.common.utils.file.FileUploadUtils;
+import com.ruoyi.framework.config.RuoYiConfig;
+import com.ruoyi.project.ehs.domain.TEnvironapproval;
 import com.ruoyi.project.plant.domain.TStaffmgr;
 import com.ruoyi.project.plant.service.ITStaffmgrService;
 import com.ruoyi.project.system.domain.SysDept;
@@ -256,4 +259,18 @@ public class TSafetyapprovalController extends BaseController
         logger.info("failRow:" +String.valueOf(failRow));
         return AjaxResult.success(String.valueOf(successNumber), failRow);
     }
+
+    /**
+     * 图片上传
+     */
+    @PostMapping("/uploadPic")
+    public AjaxResult uploadFile(@RequestParam("file") MultipartFile file,String pType,String pId) throws IOException
+    {
+        if (!file.isEmpty())
+        {
+            String url = FileUploadUtils.upload(RuoYiConfig.getFilePath("/"+ pType), file);
+            return AjaxResult.success(url);
+        }
+        return AjaxResult.error("上传失败,请联系管理员");
+    }
 }

+ 18 - 1
master/src/main/java/com/ruoyi/project/ehs/domain/TSafetyapproval.java

@@ -77,7 +77,8 @@ public class TSafetyapproval extends BaseEntity
     /** 主要内容 */
     @Excel(name = "主要内容")
     private String content;
-
+    private String conPic;
+    private String conUrl;
     /** 负责人 */
     @Excel(name = "负责人")
     private String owner;
@@ -354,6 +355,22 @@ public class TSafetyapproval extends BaseEntity
         return isPermanent;
     }
 
+    public String getConPic() {
+        return conPic;
+    }
+
+    public void setConPic(String conPic) {
+        this.conPic = conPic;
+    }
+
+    public String getConUrl() {
+        return conUrl;
+    }
+
+    public void setConUrl(String conUrl) {
+        this.conUrl = conUrl;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 14 - 5
master/src/main/resources/mybatis/ehs/TSafetyapprovalMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.project.ehs.mapper.TSafetyapprovalMapper">
-    
+
     <resultMap type="TSafetyapproval" id="TSafetyapprovalResult">
         <result property="id"    column="id"    />
         <result property="plantCode"    column="plant_code"    />
@@ -36,10 +36,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="content"    column="content"    />
         <result property="deptName" column="dept_name" />
         <result property="isPermanent" column="is_permanent"    />
+        <result property="conPic"    column="con_pic"    />
+        <result property="conUrl"    column="con_url"    />
     </resultMap>
 
     <sql id="selectTSafetyapprovalVo">
-        select d.id, d.plant_code, d.approvalname, t.name, d.certno, d.effetivedate, d.validity_before, CONCAT(TO_CHAR(d.validity_before,'YYYY.MM.dd-'), TO_CHAR(d.validity_after,'YYYY.MM.dd')) AS validity, d.relatedlaw, d.responsauth, d.owner, d.reviewdate, d.nextreviewdate, d.conttype, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks, d.scope, d.follow, d.allowance, d.requirements, d.reviewer, d.validity_after, d.review_result , d.content, d.is_permanent, s.dept_name from t_safetyapproval d
+        select d.id, d.plant_code, d.approvalname, t.name, d.certno, d.effetivedate, d.validity_before, CONCAT(TO_CHAR(d.validity_before,'YYYY.MM.dd-'), TO_CHAR(d.validity_after,'YYYY.MM.dd')) AS validity, d.relatedlaw, d.responsauth, d.owner, d.reviewdate, d.nextreviewdate, d.conttype, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks, d.scope, d.follow, d.allowance, d.requirements, d.reviewer, d.validity_after, d.review_result , d.content, d.con_pic, d.con_url, d.is_permanent, s.dept_name from t_safetyapproval d
       left join sys_dept s on s.dept_id = d.dept_id
       left join t_staffmgr t on t.staffid = d.reviewer
     </sql>
@@ -66,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ${params.dataScope}
         order by d.id desc
     </select>
-    
+
     <select id="selectTSafetyapprovalById" parameterType="Long" resultMap="TSafetyapprovalResult">
         <include refid="selectTSafetyapprovalVo"/>
         where d.id = #{id}
@@ -106,6 +108,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reviewResult != null">review_result,</if>
             <if test="content != null">content,</if>
             <if test="isPermanent != null">is_permanent,</if>
+            <if test="conPic != null">con_pic,</if>
+            <if test="conUrl != null">con_url,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -136,6 +140,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reviewResult != null">#{reviewResult},</if>
             <if test="content != null">#{content},</if>
             <if test="isPermanent != null">#{isPermanent},</if>
+            <if test="conPic != null">#{conPic},</if>
+            <if test="conUrl != null">#{conUrl},</if>
+
         </trim>
     </insert>
 
@@ -168,6 +175,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="validityAfter != null">validity_after = #{validityAfter},</if>
             <if test="reviewResult != null">review_result = #{reviewResult},</if>
             <if test="content != null">content = #{content},</if>
+            <if test="conPic != null">con_pic = #{conPic},</if>
+            <if test="conUrl != null">con_url = #{conUrl},</if>
             <if test="isPermanent != null">is_permanent = #{isPermanent},</if>
         </trim>
         where id = #{id}
@@ -183,5 +192,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </update>
-    
-</mapper>
+
+</mapper>

+ 12 - 5
ui/src/views/ehs/environapproval/index.vue

@@ -149,7 +149,7 @@
       <el-table-column :label="$t('回顾结果')" align="center" prop="reviewResult" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('下次回顾日期')" align="center" prop="nextreviewdate" width="100">
         <template slot-scope="scope">
-          <span style="vertical-align:middle">{{ parseTime(scope.row.nextreviewdate, '{y}-{m}-{d}') }}</span>
+          <span style="vertical-align:middle;margin-right: 3px">{{ parseTime(scope.row.nextreviewdate, '{y}-{m}-{d}') }}</span>
           <svg-icon :icon-class="changeColorPiont(scope.row.nextreviewdate)" style="font-size: 8px"></svg-icon>
         </template>
       </el-table-column>
@@ -329,7 +329,7 @@
                 <el-upload
                   ref="picture"
                   :headers="picture.headers"
-                  :action="picture.url + '?pType=requirementsWaterPic&pId=' + picture.pId"
+                  :action="picture.url + '?pType=environapproval&pId=' + picture.pId"
                   :show-file-list="false"
                   :on-success="handleWaterAvatarSuccess"
                   list-type="picture-card"
@@ -341,7 +341,7 @@
                 <el-upload
                   ref="picture"
                   :headers="picture.headers"
-                  :action="picture.url + '?pType=requirementsExhaustPic&pId=' + picture.pId"
+                  :action="picture.url + '?pType=environapproval&pId=' + picture.pId"
                   :show-file-list="false"
                   :on-success="handleExhaustAvatarSuccess"
                   list-type="picture-card"
@@ -360,7 +360,7 @@
                 <el-upload
                   ref="picture"
                   :headers="picture.headers"
-                  :action="picture.url + '?pType=contentWaterPic&pId=' + picture.pId"
+                  :action="picture.url + '?pType=environapproval&pId=' + picture.pId"
                   :show-file-list="false"
                   :on-success="handleWaterConSuccess"
                   list-type="picture-card"
@@ -372,7 +372,7 @@
                 <el-upload
                   ref="picture"
                   :headers="picture.headers"
-                  :action="picture.url + '?pType=contentExhaustPic&pId=' + picture.pId"
+                  :action="picture.url + '?pType=environapproval&pId=' + picture.pId"
                   :show-file-list="false"
                   :on-success="handleExhaustConSuccess"
                   list-type="picture-card"
@@ -796,6 +796,7 @@ export default {
       }else if (timeInterval <= 30 * 24 * 3600 * 1000) {
         return 'roundYellow'
       }
+      return ''
     },
     /** 查询环保批文清单列表 */
     getList() {
@@ -1011,6 +1012,12 @@ export default {
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.isPermanent === 0) {
+            if (!this.chooseDate ) {
+              this.$confirm('请填写证书有效期', this.$t('警告'), {
+                type: "warning"
+              })
+              return
+            }
             this.form.validityBefore = this.chooseDate[0];
             this.form.validityAfter = this.chooseDate[1];
           }

+ 9 - 1
ui/src/views/ehs/fireapproval/index.vue

@@ -113,7 +113,7 @@
       <el-table-column :label="$t('回顾结果')" align="center" prop="reviewResult" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('下次回顾日期')" align="center" prop="nextreviewdate" width="100">
         <template slot-scope="scope">
-          <span style="vertical-align:middle">{{ parseTime(scope.row.nextreviewdate, '{y}-{m}-{d}') }}</span>
+          <span style="vertical-align:middle;margin-right: 3px">{{ parseTime(scope.row.nextreviewdate, '{y}-{m}-{d}') }}</span>
           <svg-icon :icon-class="changeColorPiont(scope.row.nextreviewdate)" style="font-size: 8px"></svg-icon>
         </template>
       </el-table-column>
@@ -685,6 +685,8 @@ export default {
         return 'roundRed'
       }else if (timeInterval <= 30 * 24 * 3600 * 1000) {
         return 'roundYellow'
+      }else {
+        return ''
       }
     },
     getReviewer(year) {
@@ -816,6 +818,12 @@ export default {
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.isPermanent === 0) {
+            if (!this.chooseDate ) {
+              this.$confirm('请填写证书有效期', this.$t('警告'), {
+                type: "warning"
+              })
+              return
+            }
             this.form.validityBefore = this.chooseDate[0];
             this.form.validityAfter = this.chooseDate[1];
           }

+ 8 - 1
ui/src/views/ehs/healthapproval/index.vue

@@ -117,7 +117,7 @@
       <el-table-column :label="$t('回顾结果')" align="center" prop="reviewResult" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('下次回顾日期')" align="center" prop="nextreviewdate" width="100">
         <template slot-scope="scope">
-          <span style="vertical-align:middle">{{ parseTime(scope.row.nextreviewdate, '{y}-{m}-{d}') }}</span>
+          <span style="vertical-align:middle;margin-right: 3px">{{ parseTime(scope.row.nextreviewdate, '{y}-{m}-{d}') }}</span>
           <svg-icon :icon-class="changeColorPiont(scope.row.nextreviewdate)" style="font-size: 8px"></svg-icon>
         </template>
       </el-table-column>
@@ -614,6 +614,7 @@ export default {
       }else if (timeInterval <= 30 * 24 * 3600 * 1000) {
         return 'roundYellow'
       }
+      return ''
     },
      /** 查询部门下拉树结构 */
      getTreeselect() {
@@ -731,6 +732,12 @@ export default {
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.isPermanent === 0) {
+            if (!this.chooseDate) {
+              this.$confirm('请填写证书有效期', this.$t('警告'), {
+                type: "warning"
+              })
+              return
+            }
             this.form.validityBefore = this.chooseDate[0];
             this.form.validityAfter = this.chooseDate[1];
           }

+ 89 - 7
ui/src/views/ehs/safetyapproval/index.vue

@@ -102,7 +102,19 @@
       <el-table-column :label="$t('是否需要跟进')" align="center" prop="follow" :formatter="followFormat"/>
       <el-table-column :label="$t('使用/储存/废物最大量')" align="center" prop="allowance" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('排放/监控要求')" align="center" prop="requirements" :show-overflow-tooltip="true"/>
-      <el-table-column :label="$t('主要内容')" align="center" width="250" prop="content" />
+      <el-table-column :label="$t('主要内容')" align="center" width="250" prop="content">
+        <template slot-scope="scope">
+          <span v-if="scope.row.conPic === 'false'">{{ scope.row.content }}</span>
+          <span v-if="scope.row.conPic === 'true'">
+            <el-image
+              style="width: 100px; height: 100px"
+              :src=getUrl(scope.row.conUrl)
+              :preview-src-list="scope.row.conWaterList"
+              >
+            </el-image>
+          </span>
+        </template>
+      </el-table-column>
       <el-table-column :label="$t('负责人')" align="center" prop="owner" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('回顾人')" align="center" prop="reviewerName" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('本次回顾日期')" align="center" prop="reviewdate" width="100">
@@ -113,7 +125,7 @@
       <el-table-column :label="$t('回顾结果')" align="center" prop="reviewResult" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('下次回顾日期')" align="center" prop="nextreviewdate" width="100">
         <template slot-scope="scope">
-          <span style="vertical-align:middle">{{ parseTime(scope.row.nextreviewdate, '{y}-{m}-{d}') }}</span>
+          <span style="vertical-align:middle;margin-right: 3px">{{ parseTime(scope.row.nextreviewdate, '{y}-{m}-{d}') }}</span>
           <svg-icon :icon-class="changeColorPiont(scope.row.nextreviewdate)" style="font-size: 8px"></svg-icon>
         </template>
       </el-table-column>
@@ -276,10 +288,30 @@
             </el-form-item>
           </el-col>
         </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item :label="$t('主要内容为图表')" prop="conPic">
+              <el-checkbox v-model="form.conPic"></el-checkbox>
+            </el-form-item>
+          </el-col>
+        </el-row>
         <el-row>
           <el-col :span="12">
             <el-form-item :label="$t('主要内容')" prop="content">
-              <el-input v-model="form.content" type="textarea" :placeholder="$t('请输入') + $t('主要内容')" />
+              <el-input v-if="form.conPic == false" v-model="form.content" type="textarea" :placeholder="$t('请输入') + $t('主要内容')" />
+              <span v-if="form.conPic == true">
+                <el-upload
+                  ref="picture"
+                  :headers="picture.headers"
+                  :action="picture.url + '?pType=safetyapproval&pId=' + picture.pId"
+                  :show-file-list="false"
+                  :on-success="handleConSuccess"
+                  list-type="picture-card"
+                  style="display: inline-block">
+                  <img v-if="conWaterUrl" :src="conWaterUrl" class="avatar">
+                  <i v-else class="el-icon-plus "></i>
+                </el-upload>
+              </span>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -593,6 +625,18 @@ export default {
       },
       // 表单参数
       form: {},
+      picture: {
+        file: "",
+        // 报告附件上传位置编号
+        ids: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/ehs/safetyapproval/uploadPic",
+        pType: 'safetyapproval',
+        pId: null
+      },
+      conWaterUrl: "",
       //证书是否永久
       canChange: false,
       // 表单校验
@@ -645,9 +689,6 @@ export default {
         reviewResult: [
           { required: true, message: this.$t('回顾结果') + this.$t('不能为空'), trigger: "blur" }
         ],
-        content: [
-          { required: true, message: this.$t('主要内容') + this.$t('不能为空'), trigger: "blur" }
-        ],
         deptId: [
           { required: true, message: this.$t('归属部门') + this.$t('不能为空'), trigger: "blur" }
         ]
@@ -679,12 +720,24 @@ export default {
     });
   },
   methods: {
+    getUrl(value){
+      return process.env.VUE_APP_BASE_API +  value
+    },
     /** 查询安全批文清单列表 */
     getList() {
       this.loading = true;
       listSafetyapproval(this.queryParams).then(response => {
         this.safetyapprovalList = response.rows;
         this.total = response.total;
+        this.safetyapprovalList.forEach(function (item) {
+          if (item.conPic === 'true') {
+            if (item.conUrl) {
+              var conWaterList = [];
+              conWaterList.push(process.env.VUE_APP_BASE_API + item.conUrl);
+              item.conWaterList = conWaterList;
+            }
+          }
+        })
         this.loading = false;
       });
     },
@@ -695,6 +748,7 @@ export default {
       }else if (timeInterval <= 30 * 24 * 3600 * 1000) {
         return 'roundYellow'
       }
+      return ''
     },
      /** 查询部门下拉树结构 */
      getTreeselect() {
@@ -737,6 +791,7 @@ export default {
     },
     // 表单重置
     reset() {
+      this.conWaterUrl = '';
       this.form = {
         id: null,
         plantCode: null,
@@ -756,7 +811,9 @@ export default {
         updaterCode: null,
         updatedate: null,
         deptId: null,
-        remarks: null
+        remarks: null,
+        conPic: null,
+        conUrl: null,
       };
       this.resetForm("form");
     },
@@ -790,6 +847,7 @@ export default {
       this.reset();
       this.open = true;
       this.chooseDate = [];
+      this.form.conPic = false;
       this.title = this.$t('新增') + " " + this.$t('安全批文清单');
       this.getReviewer()
     },
@@ -802,12 +860,21 @@ export default {
       }else if (row.isPermanent == 0){
         this.canChange = false
       }
+
       const id = row.id || this.ids
       getSafetyapproval(id).then(response => {
         this.form = response.data;
         this.chooseDate = this.$set(this.form,'chooseDate',[""+response.data.validityBefore+"",""+response.data.validityAfter+""]);
         this.open = true;
         this.title = this.$t('修改') + this.$t('安全批文清单');
+        if (this.form.conPic === 'true') {
+          this.form.conPic = true
+        }else {
+          this.form.conPic = false
+        }
+        if(response.data.conUrl) {
+          this.conWaterUrl = process.env.VUE_APP_BASE_API + response.data.conUrl;
+        }
         //根据回顾日期筛选
         this.getReviewer( response.data.reviewdate.substring(0,4))
       });
@@ -822,6 +889,12 @@ export default {
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.isPermanent === 0) {
+            if (!this.chooseDate) {
+              this.$confirm('请填写证书有效期', this.$t('警告'), {
+                type: "warning"
+              })
+              return
+            }
             this.form.validityBefore = this.chooseDate[0];
             this.form.validityAfter = this.chooseDate[1];
           }
@@ -950,6 +1023,11 @@ export default {
       a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
       a.click()
     },
+    handleConSuccess (res, file, fileList) {
+      this.conWaterUrl =  URL.createObjectURL(file.raw);
+      this.form.conUrl = res.msg
+      this.$alert(res.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
+    },
     //pdf预览
     openPdf(){
         window.open(this.pdf.pdfUrl);//path是文件的全路径地址
@@ -968,4 +1046,8 @@ export default {
   .el-table .cell {
     white-space: pre-line;
   }
+  .avatar {
+    width: 120px;
+    height: 140px;
+  }
 </style>