shi'sen'yuan 3 лет назад
Родитель
Сommit
a3885f8863

+ 20 - 0
master/src/main/java/com/ruoyi/project/ehs/controller/TEnvironapprovalController.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.plant.domain.TStaffmgr;
 import com.ruoyi.project.system.domain.SysDept;
 import com.ruoyi.project.system.domain.SysDictData;
 import com.ruoyi.project.system.service.ISysDeptService;
@@ -232,4 +235,21 @@ public class TEnvironapprovalController 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);
+            TEnvironapproval environapproval = tEnvironapprovalService.selectTEnvironapprovalById(Long.parseLong(pId));
+            environapproval.setRequirements(url);
+            tEnvironapprovalService.updateTEnvironapproval(environapproval);
+            return AjaxResult.success();
+        }
+        return AjaxResult.error("上传失败,请联系管理员");
+    }
 }

+ 4 - 0
master/src/main/java/com/ruoyi/project/ehs/domain/TEnvironapproval.java

@@ -112,6 +112,7 @@ public class TEnvironapproval extends BaseEntity
     /** 排放/监控要求 */
     @Excel(name = "排放/监控要求")
     private String requirements;
+    private String reqPic;
 
     /** 回顾人 */
     @Excel(name = "回顾人")
@@ -332,6 +333,9 @@ public class TEnvironapproval extends BaseEntity
     public void setRequirements(String requirements) { this.requirements = requirements; }
 
     public String getRequirements() { return requirements; }
+    public String getReqPic() { return reqPic; }
+
+    public void setReqPic(String reqPic) { this.reqPic = reqPic; }
     public void setReviewer(String reviewer) { this.reviewer = reviewer; }
 
     public String getReviewer() { return reviewer; }

+ 5 - 0
master/src/main/java/com/ruoyi/project/ehs/domain/TMsds.java

@@ -164,6 +164,7 @@ public class TMsds extends BaseEntity {
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     @Excel(name = "出版日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date issueTime;
+    private String issueTimeYear;
 
     /** 出版日期2 */
     @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
@@ -432,6 +433,10 @@ public class TMsds extends BaseEntity {
         return issueTime;
     }
 
+    public String getIssueTimeYear() { return issueTimeYear; }
+
+    public void setIssueTimeYear(String issueTimeYear) { this.issueTimeYear = issueTimeYear; }
+
     public void setVersion(String version) {
         this.version = version;
     }

+ 5 - 1
master/src/main/resources/mybatis/ehs/TEnvironapprovalMapper.xml

@@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="follow"    column="follow"    />
         <result property="allowance"    column="allowance"    />
         <result property="requirements"    column="requirements"    />
+        <result property="reqPic"    column="req_pic"    />
         <result property="reviewer"    column="reviewer"    />
         <result property="reviewerName"    column="name"    />
         <result property="reviewResult"    column="review_result"    />
@@ -38,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTEnvironapprovalVo">
-        select d.id, d.plant_code, d.approvalname, t.name, d.certno, d.effetivedate, d.is_permanent, d.validity_before, 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 ,s.dept_name from t_environapproval d
+        select d.id, d.plant_code, d.approvalname, t.name, d.certno, d.effetivedate, d.is_permanent, d.validity_before, 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.req_pic, d.reviewer, d.validity_after, d.review_result, d.content ,s.dept_name from t_environapproval d
       left join sys_dept s on s.dept_id = d.dept_id
       left join t_staffmgr t on t.staffid = d.reviewer
     </sql>
@@ -108,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="follow != null">follow,</if>
             <if test="allowance != null">allowance,</if>
             <if test="requirements != null">requirements,</if>
+            <if test="reqPic != null">req_pic,</if>
             <if test="reviewer != null">reviewer,</if>
             <if test="reviewResult != null">review_result,</if>
             <if test="validityAfter != null">validity_after,</if>
@@ -138,6 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="follow != null">#{follow},</if>
             <if test="allowance != null">#{allowance},</if>
             <if test="requirements != null">#{requirements},</if>
+            <if test="reqPic != null">#{reqPic},</if>
             <if test="reviewer != null">#{reviewer},</if>
             <if test="reviewResult != null">#{reviewResult},</if>
             <if test="validityAfter != null">#{validityAfter},</if>
@@ -171,6 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="follow != null">follow = #{follow},</if>
             <if test="allowance != null">allowance = #{allowance},</if>
             <if test="requirements != null">requirements = #{requirements},</if>
+            <if test="reqPic != null">req_pic = #{reqPic},</if>
             <if test="reviewer != null">reviewer = #{reviewer},</if>
             <if test="reviewResult != null">review_result = #{reviewResult},</if>
             <if test="validityAfter != null">validity_after = #{validityAfter},</if>

+ 2 - 18
master/src/main/resources/mybatis/ehs/TMsdsMapper.xml

@@ -49,27 +49,11 @@
     <select id="selectTMsdsList" parameterType="TMsds" resultMap="TMsdsResult">
         <include refid="selectTMsdsVo"/>
         <where>
-            <if test="enName != null  and enName != ''"> and en_name like concat(concat('%', #{enName}), '%')</if>
             <if test="cnName != null  and cnName != ''"> and cn_name like concat(concat('%', #{cnName}), '%')</if>
-            <if test="casNo != null  and casNo != ''"> and cas_no like concat(concat('%', #{casNo}), '%')</if>
-            <if test="hazardPhrases != null  and hazardPhrases != ''"> and hazard_phrases like concat(concat('%', #{hazardPhrases}), '%')</if>
             <if test="cmr != null  and cmr != ''"> and cmr like concat(concat('%', #{cmr}), '%')</if>
-            <if test="ghsPictogram != null  and ghsPictogram != ''"> and ghs_pictogram like concat(concat('%', #{ghsPictogram}), '%')</if>
-            <if test="holdup != null  and holdup != ''"> and holdup = #{holdup}</if>
-            <if test="workArea != null  and workArea != ''"> and work_area = #{workArea}</if>
-            <if test="form != null  and form != ''"> and form = #{form}</if>
-            <if test="explosionLimit != null  and explosionLimit != ''"> and explosion_limit = #{explosionLimit}</if>
-            <if test="meltingPoint != null  and meltingPoint != ''"> and melting_point = #{meltingPoint}</if>
-            <if test="boilingPoint != null  and boilingPoint != ''"> and boiling_point = #{boilingPoint}</if>
-            <if test="density != null  and density != ''"> and density = #{density}</if>
-            <if test="purity != null  and purity != ''"> and purity = #{purity}</if>
-            <if test="responsibleCompany != null  and responsibleCompany != ''"> and responsible_company = #{responsibleCompany}</if>
             <if test="issueTime != null "> and issue_time = #{issueTime}</if>
-            <if test="version != null  and version != ''"> and version = #{version}</if>
-            <if test="reviewer != null  and reviewer != ''"> and reviewer = #{reviewer}</if>
-            <if test="reviewdate != null "> and reviewdate = #{reviewdate}</if>
-            <if test="reviewState != null  and reviewState != ''"> and review_state = #{reviewState}</if>
-            <if test="nextReviewdate != null "> and next_reviewdate = #{nextReviewdate}</if>
+            <if test="productcategory != null "> and productcategory = #{productcategory}</if>
+            <if test="issueTimeYear != null "> and to_char(d.issue_time,'yyyy') = #{issueTimeYear}</if>
             and d.del_flag = 0
         </where>
         <!-- 数据范围过滤 -->

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

@@ -83,7 +83,17 @@
       <el-table-column :label="$t('证书有效期')" align="center" width="300" prop="validity" />
       <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" prop="requirementsUrl" :show-overflow-tooltip="true">
+        <template slot-scope="scope">
+          <span v-if="scope.row.reqPic === 'false'">{{ scope.row.requirements }}</span>
+          <el-image
+            style="width: 100px; height: 100px"
+            v-if="scope.row.reqPic === 'true'"
+            :src="scope.row.requirementsUrl"
+            :preview-src-list="scope.row.srcList">
+          </el-image>
+        </template>
+      </el-table-column>
       <el-table-column :label="$t('主要内容')" align="center" width="250" prop="content"/>
       <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"/>
@@ -228,8 +238,22 @@
         <el-form-item :label="$t('使用/储存/废物最大量')" prop="allowance">
           <el-input v-model="form.allowance" :placeholder="$t('请输入') + $t('使用/储存/废物最大量')" />
         </el-form-item>
+        <el-form-item label="排放/监控要求为图表" prop="reqPic">
+          <el-checkbox v-model="form.reqPic" @change="changereqPic"></el-checkbox>
+        </el-form-item>
         <el-form-item :label="$t('排放/监控要求')" prop="requirements">
-          <el-input v-model="form.requirements" :placeholder="$t('请输入') + $t('排放/监控要求')" />
+          <el-input v-if="form.reqPic === false" v-model="form.requirements" :placeholder="$t('请输入') + $t('排放/监控要求')" />
+          <el-upload
+            ref="requirements"
+            :headers="requirements.headers"
+            :action="requirements.url + '?pType=' + requirements.pType + '&pId=' + requirements.pId"
+            v-if="form.reqPic === true"
+            :show-file-list="false"
+            :on-success="handleAvatarSuccess"
+            list-type="picture-card">
+            <img v-if="requirementsUrl" :src="requirementsUrl" class="avatar">
+            <i v-else class="el-icon-plus "></i>
+          </el-upload>
         </el-form-item>
         <el-form-item :label="$t('主要内容')" prop="content">
           <el-input v-model="form.content" type="textarea" :placeholder="$t('请输入') + $t('主要内容')" />
@@ -510,6 +534,19 @@ export default {
         pageTotalNum: 1,
         loadedRatio: 0,
       },
+      requirements: {
+        file: "",
+        // 报告附件上传位置编号
+        ids: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/ehs/environapproval/uploadPic",
+        pType: 'requirementsPic',
+        pId: null
+      },
+      //图片url
+      requirementsUrl: '',
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -609,6 +646,14 @@ export default {
       this.loading = true;
       listEnvironapproval(this.queryParams).then(response => {
         this.environapprovalList = response.rows;
+        this.environapprovalList.forEach(function (item) {
+          if (item.reqPic === 'true') {
+            item.requirementsUrl = process.env.VUE_APP_BASE_API + item.requirements;
+            var srcList = [];
+            srcList.push(process.env.VUE_APP_BASE_API + item.requirements);
+            item.srcList = srcList;
+          }
+        })
         this.total = response.total;
         this.loading = false;
       });
@@ -643,14 +688,14 @@ export default {
     },
     // 表单重置
     reset() {
+       this.requirementsUrl = '';
       this.form = {
         id: null,
         plantCode: null,
         approvalname: null,
         certno: null,
         effetivedate: null,
-        isPermanent: null,
-        validity: null,
+        validityBefore: null,
         relatedlaw: null,
         responsauth: null,
         owner: null,
@@ -663,7 +708,18 @@ export default {
         updaterCode: null,
         updatedate: null,
         deptId: null,
-        remarks: null
+        remarks: null,
+        isPermanent: null,
+        scope: null,
+        follow: null,
+        allowance: null,
+        requirements: null,
+        reviewer: null,
+        reviewResult: null,
+        validityAfter: null,
+        content: null,
+        reqPic: null,
+        requirementsUrl: null
       };
       this.chooseDate = []
       this.resetForm("form");
@@ -717,6 +773,15 @@ export default {
           this.canChange = false
           this.chooseDate = this.$set(this.form,'chooseDate',[""+response.data.validityBefore+"",""+response.data.validityAfter+""]);
         }
+        if (this.form.reqPic === 'true') {
+          this.form.reqPic = true
+        }else {
+          this.form.reqPic = false
+        }
+        if(response.data.requirements) {
+          this.requirementsUrl = process.env.VUE_APP_BASE_API + response.data.requirements;
+        }
+        this.requirements.pId = row.id;
         this.open = true;
         this.title = this.$t('修改') + this.$t('环保批文清单');
       });
@@ -818,6 +883,10 @@ export default {
         this.$refs.doc.clearFiles()
       })
     },
+    //上传图片改变选项
+    changereqPic() {
+      this.form.requirements = null;
+    },
     getFileList (){
       allFileList(this.doc.queryParams).then(response => {
         this.doc.commonfileList = response;
@@ -877,6 +946,10 @@ export default {
         this.msgError(this.$t('pdf加载失败'))
       })
     },
+    handleAvatarSuccess (res, file, fileList) {
+      this.requirementsUrl =  URL.createObjectURL(file.raw);
+      this.$alert(res.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
+    },
     // pdf上一页
     prePage() {
       let page = this.pdf.pageNum

+ 11 - 2
ui/src/views/ehs/fireapproval/index.vue

@@ -648,7 +648,6 @@ export default {
         approvalname: null,
         fileno: null,
         effetivedate: null,
-        validity: null,
         relatedlaw: null,
         responsauth: null,
         owner: null,
@@ -660,7 +659,17 @@ export default {
         updaterCode: null,
         updatedate: null,
         deptId: null,
-        remarks: null
+        validityBefore: null,
+        remarks: null,
+        scope: null,
+        follow: null,
+        allowance: null,
+        requirements: null,
+        reviewer: null,
+        reviewResult: null,
+        validityAfter: null,
+        content: null,
+        isPermanent: null
       };
       this.resetForm("form");
     },

+ 36 - 21
ui/src/views/ehs/msds/index.vue

@@ -1,6 +1,16 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item :label="$t('产品类别')" prop="productcategory">
+        <el-select v-model="queryParams.productcategory" :placeholder="$t('请选择') + $t('产品类别')" clearable size="small">
+          <el-option
+            v-for="dict in productcategoryOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          ></el-option>
+        </el-select>
+      </el-form-item>
       <el-form-item :label="$t('中文名称')" prop="cnName">
         <el-input
           v-model="queryParams.cnName"
@@ -10,18 +20,8 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item :label="$t('危险警句')" prop="hazardPhrases">
-        <el-select v-model="queryParams.hazardPhrases" filterable :placeholder="$t('请选择')+$t('危险警句')" clearable size="small">
-          <el-option
-            v-for="dict in hazardPhrasesOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
-          />
-        </el-select>
-      </el-form-item>
-      <el-form-item :label="$t('是否三致物')" prop="cmr">
-        <el-select v-model="queryParams.cmr" :placeholder="$t('请选择')+$t('是否三致物')" clearable size="small">
+      <el-form-item :label="$t('是否三致物')" prop="cmr" label-width="80">
+        <el-select v-model="cmrs" :placeholder="$t('请选择')+$t('是否三致物')" clearable multiple size="small">
           <el-option
             v-for="dict in cmrOptions"
             :key="dict.dictValue"
@@ -30,15 +30,14 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item :label="$t('GHS符号')" prop="ghsPictogram">
-        <el-select v-model="queryParams.ghsPictogram" :placeholder="$t('请选择')+$t('GHS符号')" clearable size="small">
-          <el-option
-            v-for="dict in ghsPictogramOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
-          />
-        </el-select>
+      <el-form-item :label="$t('出版日期')" prop="issueTimeYear">
+        <el-date-picker clearable size="small" style="width: 200px"
+                        v-model="queryParams.issueTimeYear"
+                        type="year"
+                        value-format="yyyy"
+                        :placeholder="$t('请选择') + $t('年份')"
+                        @keyup.enter.native="handleQuery">
+        </el-date-picker>
       </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
@@ -607,6 +606,7 @@
           casNo: null,
           hazardPhrases: null,
           cmr: null,
+          cmrs: null,
           ghsPictogram: null,
           holdup: null,
           workArea: null,
@@ -618,6 +618,7 @@
           purity: null,
           responsibleCompany: null,
           issueTime: null,
+          issueTimeYear: null,
           version: null,
           reviewer: null,
           reviewdate: null,
@@ -626,6 +627,8 @@
         },
         // 表单参数
         form: {},
+        //筛选多选
+        cmrs: [],
         // 表单校验
         rules: {
           deptId: [
@@ -671,6 +674,17 @@
       getList() {
         let _this=this;
         this.loading = true;
+        var cmrId = null;
+        if (this.cmrs !== null) {
+          this.cmrs.forEach(function (value, key, arr) {
+            if (key != 0) {
+              cmrId = cmrId + "," + value;
+            }else if (key == 0) {
+              cmrId = value;
+            }
+          })
+          this.queryParams.cmr = cmrId;
+        }
         listMsds(this.queryParams).then(response => {
           this.msdsList = response.rows;
           this.msdsList.forEach(function (value,key,arr) {
@@ -872,6 +886,7 @@
       /** 重置按钮操作 */
       resetQuery() {
         this.resetForm("queryForm");
+        this.cmrs = []
         this.handleQuery();
       },
       // 多选框选中数据