Bläddra i källkod

张丁 修改作业票

zhangding 3 år sedan
förälder
incheckning
f94c82af4e

+ 1 - 0
master/src/main/java/com/ruoyi/project/ehs/controller/TJobticketController.java

@@ -141,6 +141,7 @@ public class TJobticketController extends BaseController
         for (int i = 0; i < dto.size(); i++) {
             TJobticket tJobticket=new TJobticket();
             TInvoiceWorkcontent tInvoiceWorkcontent=dto.get(i);
+            tJobticket.setDeptId(tInvoiceWorkcontent.getDeptId());
             tJobticket.setContent(tInvoiceWorkcontent.getBookingworkticket().getWorkArea()+tInvoiceWorkcontent.getWorkDescription());
             //byc 联系人 用户主管+用户单位
             if(tInvoiceWorkcontent.getBookingworkticket().getUserUnit()!=null){

+ 16 - 0
master/src/main/java/com/ruoyi/project/ehs/domain/TJobticket.java

@@ -158,6 +158,10 @@ public class TJobticket extends BaseEntity
     @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     private Date endDate;
 
+    /** 新票/续票次数限制 */
+    @Excel(name = "新票/续票次数限制")
+    private Long postponeNumber;
+
     public void setId(Long id)
     {
         this.id = id;
@@ -508,6 +512,18 @@ public class TJobticket extends BaseEntity
                 .append("mbzyxkzh", getMbzyxkzh())
                 .append("gczyxkzh", getGczyxkzh())
                 .append("gczyjb", getGczyjb())
+                .append("postponeNumber", getPostponeNumber())
+
             .toString();
     }
+
+    public Long getPostponeNumber() {
+        return postponeNumber;
+    }
+
+    public void setPostponeNumber(Long postponeNumber) {
+        this.postponeNumber = postponeNumber;
+    }
+
+
 }

+ 44 - 19
master/src/main/java/com/ruoyi/project/invoice/controller/TInvoiceBookingworkticketController.java

@@ -7,6 +7,7 @@ import com.deepoove.poi.data.Texts;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.SpringContextUtils;
+import com.ruoyi.common.utils.*;
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
@@ -130,17 +131,13 @@ public class TInvoiceBookingworkticketController extends BaseController
         //字典查询
         List<SysDictData> book_work_type = iSysDictTypeService.selectDictDataByType("book_work_type");
         //
-        List<TInvoiceWorkcontent>  newtInvoiceWorkcontentList =new ArrayList<>();
-        List<TInvoiceBookingworkticket> list = tInvoiceBookingworkticketService.selectTInvoiceBookingworkticketList(tInvoiceBookingworkticket);
-        for(int i=0;i<list.size();i++){
-            //遍历每一条主表  找到所有的子表 根据每条子表 将主表也同步到每一条数据
-            TInvoiceBookingworkticket bookingworkticket= list.get(i);
-            List<TInvoiceWorkcontent>  workcontentList = tInvoiceBookingworkticketService.selectTInvoiceWorkcontentBybookingticketId(bookingworkticket.getId());
-            for (TInvoiceWorkcontent workcontent : workcontentList) {
-                workcontent.setBookingworkticket(bookingworkticket);
-                newtInvoiceWorkcontentList.add(workcontent);
-            }
+
+        List<TInvoiceWorkcontent> tInvoiceWorkcontentList = tInvoiceBookingworkticketService.selectTInvoiceWorkcontentList(tInvoiceBookingworkticket);
+        for (TInvoiceWorkcontent workcontent : tInvoiceWorkcontentList) {
+            TInvoiceBookingworkticket bookingworkticket=tInvoiceBookingworkticketService.selectTInvoiceBookingworkticketById(workcontent.getBookingticketId());
+            workcontent.setBookingworkticket(bookingworkticket);
         }
+
         SXSSFWorkbook wb = new SXSSFWorkbook(1000);
         CellStyle wrapStyle = wb.createCellStyle();
         wrapStyle.setWrapText(true);    //设置自动换行
@@ -188,7 +185,7 @@ public class TInvoiceBookingworkticketController extends BaseController
         //填充数据
         int rowIndex = 1;
         int columnIndex = 1;
-        for (TInvoiceWorkcontent t: newtInvoiceWorkcontentList) {
+        for (TInvoiceWorkcontent t: tInvoiceWorkcontentList) {
             Row row = sheet.createRow(rowIndex);
             row.createCell(0).setCellValue("扬子石化-巴斯夫有限责任公司");
             //作业类型
@@ -288,7 +285,7 @@ public class TInvoiceBookingworkticketController extends BaseController
         int workType10=0; int workType11=0; int workType12=0; int workType13=0; int workType14=0;
         int workType15=0; int workType16=0; int workType17=0;
         //填充下一个表格
-        for (TInvoiceWorkcontent t: newtInvoiceWorkcontentList) {
+        for (TInvoiceWorkcontent t: tInvoiceWorkcontentList) {
             //先将字符串 分割数组 再转成集合 防止出现 1,11这种情况判断不清
             String newStr=t.getWorkType()+",";
             String[] wtArr=newStr.split(",");
@@ -317,7 +314,7 @@ public class TInvoiceBookingworkticketController extends BaseController
                 workType11++;//清罐
             }else  if(contentlist.contains("16")){
                 workType12++;//倒灌
-            }else  if(contentlist.contains("16")){
+            }else  if(contentlist.contains("18")){
                 workType13++;//切水
             }else {
                 //变更、承包、停车装置暂无数据
@@ -343,7 +340,7 @@ public class TInvoiceBookingworkticketController extends BaseController
         row.createCell(15).setCellValue(0);
         row.createCell(16).setCellValue(0);
         row.createCell(17).setCellValue(0);
-        row.createCell(18).setCellValue(newtInvoiceWorkcontentList.size());
+        row.createCell(18).setCellValue(tInvoiceWorkcontentList.size());
 
 
         OutputStream out = null;
@@ -510,6 +507,9 @@ public class TInvoiceBookingworkticketController extends BaseController
         StringBuilder content=new StringBuilder();
         StringBuilder contentUserUnit=new StringBuilder();
         StringBuilder contentUserWorkType=new StringBuilder();
+        StringBuilder contentTicket=new StringBuilder();
+        String ct=new String();
+        String cuw=new String();
         //关联的申请流程
         TApproveReserveInvoice tApproveReserveInvoice= tApproveReserveInvoiceService.selectTApproveReserveInvoiceByinvoiceId(ticket.getId().toString());
         for(int i =0;i<tInvoiceWorkcontentList.size();i++){
@@ -579,10 +579,13 @@ public class TInvoiceBookingworkticketController extends BaseController
                 for (SysDictData p : book_work_type) {
                     for (String t : contentlist)
                         if (t.equals(p.getDictValue())) {
-                        contentUserWorkType.append(p.getDictLabel());//作业类型
+                        contentUserWorkType.append(","+p.getDictLabel());//作业类型
                     }
                 }
-                    params.put("workType"+i, Texts.of(contentUserWorkType.toString()).fontSize(10).bold().create());
+                if(contentUserWorkType.toString().startsWith(",")){
+                    cuw=contentUserWorkType.substring(1);
+                }
+                    params.put("workType"+i, Texts.of(cuw).fontSize(10).bold().create());
 
             }
             //作业开始时间
@@ -593,10 +596,31 @@ public class TInvoiceBookingworkticketController extends BaseController
             if(ticket.getWorkEndTime()!=null){
                 params.put("workEndTime",Texts.of(DateUtils.dateTime(ticket.getWorkEndTime())).fontSize(10).bold().create());
             }
-            //关联票号
-            if(tInvoiceWorkcontent.getReservationNumber()!=null){
-                params.put("associated"+i, Texts.of(tInvoiceWorkcontent.getReservationNumber()).fontSize(10).bold().create());
+            //关联票号  有几个许可证 就追加几个
+            if(ticket!=null){
+                if(!StringUtils.isEmpty(tInvoiceWorkcontent.getWhgzxkzh())){
+                    contentTicket.append(tInvoiceWorkcontent.getWhgzxkzh());
+                }
+                if(!StringUtils.isEmpty(tInvoiceWorkcontent.getDhzyxkzh())){
+                    contentTicket.append(","+tInvoiceWorkcontent.getDhzyxkzh());
+                }
+                if(!StringUtils.isEmpty(tInvoiceWorkcontent.getXzkjxkzh())){
+                    contentTicket.append(","+tInvoiceWorkcontent.getXzkjxkzh());
+                }
+                if(!StringUtils.isEmpty(tInvoiceWorkcontent.getMbzyxkzh())){
+                    contentTicket.append(","+tInvoiceWorkcontent.getMbzyxkzh());
+                }
+                if(!StringUtils.isEmpty(tInvoiceWorkcontent.getGczyxkzh())){
+                    contentTicket.append(","+tInvoiceWorkcontent.getGczyxkzh());
+                }
+                if(contentTicket.toString().startsWith(",")){
+                   ct=contentTicket.substring(1);
+                }else {
+                    ct=contentTicket.toString();
+                }
+                params.put("associated"+i, Texts.of(ct).fontSize(10).bold().create());
             }
+
             //申请单编号  字体红色
             if (!params.containsKey("application")) {
                 params.put("application", Texts.of(DateUtils.dateTimeNow()).fontSize(10).color("FF0000").bold().create());
@@ -655,6 +679,7 @@ public class TInvoiceBookingworkticketController extends BaseController
             }
             content.delete(0, content.length());
             contentUserWorkType.delete(0, contentUserWorkType.length());
+            contentTicket.delete(0, contentUserWorkType.length());
         }
         // 渲染文本
         return params;

+ 39 - 11
master/src/main/java/com/ruoyi/project/listener/invoiceApprove/InvoiceEndSuccessListener.java

@@ -9,6 +9,7 @@ import com.github.stuxuhai.jpinyin.PinyinHelper;
 import com.ruoyi.common.sendEmail.IMailService;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SpringContextUtils;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.project.invoice.domain.TApproveReserveInvoice;
@@ -168,6 +169,9 @@ public class InvoiceEndSuccessListener implements Serializable, ExecutionListene
         StringBuilder content=new StringBuilder();
         StringBuilder contentUserUnit=new StringBuilder();
         StringBuilder contentUserWorkType=new StringBuilder();
+        StringBuilder contentTicket=new StringBuilder();
+        String ct=new String();
+        String cuw=new String();
         //关联的申请流程
         TApproveReserveInvoice tApproveReserveInvoice= tApproveReserveInvoiceService.selectTApproveReserveInvoiceByinvoiceId(ticket.getId().toString());
         for(int i =0;i<tInvoiceWorkcontentList.size();i++){
@@ -177,7 +181,6 @@ public class InvoiceEndSuccessListener implements Serializable, ExecutionListene
                 for (SysDictData p : book_risk_level) {
                     if (tInvoiceWorkcontent.getRiskLevel().toString().equals(p.getDictValue())) {
                         content.append(ticket.getWorkArea()+","+tInvoiceWorkcontent.getWorkDescription());//装置名称
-
                     }
                 }
             }
@@ -215,16 +218,16 @@ public class InvoiceEndSuccessListener implements Serializable, ExecutionListene
             if(tApproveReserveInvoice.getUserId()!=null) {
                 if (!params.containsKey("userName")) {
                     SysUser sysUser = sysUserService.selectUserById(tApproveReserveInvoice.getUserId());
-            if(sysUser.getSignUrl()!=null){
-                params.put("userName",Pictures.ofLocal(fileName(sysUser.getSignUrl())).size(100, 40).create());
-            }
+                    if(sysUser.getSignUrl()!=null){
+                        params.put("userName",Pictures.ofLocal(fileName(sysUser.getSignUrl())).size(100, 40).create());
+                    }
                 }
             }
             //联系电话
             if(tApproveReserveInvoice.getUserId()!=null) {
                 SysUser sysUser = sysUserService.selectUserById(tApproveReserveInvoice.getUserId());
                 String dName= sysUser.getPhonenumber();
-                   //如果没有添加过  找到用户所属的部门添加进去
+                //如果没有添加过  找到用户所属的部门添加进去
                 if (!params.containsKey("conUnit")) {
                     params.put("conUnit",Texts.of(dName).fontSize(10).bold().create());
                 }
@@ -238,10 +241,13 @@ public class InvoiceEndSuccessListener implements Serializable, ExecutionListene
                 for (SysDictData p : book_work_type) {
                     for (String t : contentlist)
                         if (t.equals(p.getDictValue())) {
-                            contentUserWorkType.append(p.getDictLabel());//作业类型
+                            contentUserWorkType.append(","+p.getDictLabel());//作业类型
                         }
                 }
-                params.put("workType"+i, Texts.of(contentUserWorkType.toString()).fontSize(10).bold().create());
+                if(contentUserWorkType.toString().startsWith(",")){
+                    cuw=contentUserWorkType.substring(1);
+                }
+                params.put("workType"+i, Texts.of(cuw).fontSize(10).bold().create());
 
             }
             //作业开始时间
@@ -252,10 +258,31 @@ public class InvoiceEndSuccessListener implements Serializable, ExecutionListene
             if(ticket.getWorkEndTime()!=null){
                 params.put("workEndTime",Texts.of(DateUtils.dateTime(ticket.getWorkEndTime())).fontSize(10).bold().create());
             }
-            //关联票号
-            if(tInvoiceWorkcontent.getReservationNumber()!=null){
-                params.put("associated"+i, Texts.of(tInvoiceWorkcontent.getReservationNumber()).fontSize(10).bold().create());
+            //关联票号  有几个许可证 就追加几个
+            if(ticket!=null){
+                if(!StringUtils.isEmpty(tInvoiceWorkcontent.getWhgzxkzh())){
+                    contentTicket.append(tInvoiceWorkcontent.getWhgzxkzh());
+                }
+                if(!StringUtils.isEmpty(tInvoiceWorkcontent.getDhzyxkzh())){
+                    contentTicket.append(","+tInvoiceWorkcontent.getDhzyxkzh());
+                }
+                if(!StringUtils.isEmpty(tInvoiceWorkcontent.getXzkjxkzh())){
+                    contentTicket.append(","+tInvoiceWorkcontent.getXzkjxkzh());
+                }
+                if(!StringUtils.isEmpty(tInvoiceWorkcontent.getMbzyxkzh())){
+                    contentTicket.append(","+tInvoiceWorkcontent.getMbzyxkzh());
+                }
+                if(!StringUtils.isEmpty(tInvoiceWorkcontent.getGczyxkzh())){
+                    contentTicket.append(","+tInvoiceWorkcontent.getGczyxkzh());
+                }
+                if(contentTicket.toString().startsWith(",")){
+                    ct=contentTicket.substring(1);
+                }else {
+                    ct=contentTicket.toString();
+                }
+                params.put("associated"+i, Texts.of(ct).fontSize(10).bold().create());
             }
+
             //申请单编号  字体红色
             if (!params.containsKey("application")) {
                 params.put("application", Texts.of(DateUtils.dateTimeNow()).fontSize(10).color("FF0000").bold().create());
@@ -271,7 +298,7 @@ public class InvoiceEndSuccessListener implements Serializable, ExecutionListene
                 if (!params.containsKey("zzUser")) {
                     SysUser sysUser = sysUserService.selectUserById(tApproveReserveInvoice.getDevSupId());
                     if(sysUser.getSignUrl()!=null){
-                        params.put("zzUser", Pictures.ofLocal(fileName(sysUser.getSignUrl())).size(100, 40).create());
+                        params.put("zzUser",Pictures.ofLocal(fileName(sysUser.getSignUrl())).size(100, 40).create());
                     }
                 }
                 //装置批准人的电话
@@ -314,6 +341,7 @@ public class InvoiceEndSuccessListener implements Serializable, ExecutionListene
             }
             content.delete(0, content.length());
             contentUserWorkType.delete(0, contentUserWorkType.length());
+            contentTicket.delete(0, contentUserWorkType.length());
         }
         // 渲染文本
         return params;

+ 7 - 2
master/src/main/resources/mybatis/ehs/TJobticketMapper.xml

@@ -41,11 +41,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="mbzyxkzh"    column="mbzyxkzh"    />
         <result property="gczyxkzh"    column="gczyxkzh"    />
         <result property="gczyjb"    column="gczyjb"    />
+        <result property="postponeNumber"    column="postpone_number"    />
     </resultMap>
 
     <sql id="selectTJobticketVo">
         select d.id, d.plant_code, d.kprq, d.qfsj, d.qfbz, d.qfr, d.xpxp, d.yqxkzh, d.whgzxkzh, d.dhzyxkzh, d.hpjb, d.xzkjxkzh, d.content, d.byclxr, d.sgdw, d.lxr, d.lxdh, d.xpsj, d.zypzt, d.jccdr, d.wcxxbh, d.wcxzt, d.cxsj,
-               d.mbzyxkzh,d.gczyxkzh,d.gczyjb,d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks ,s.dept_name from t_jobticket d
+               d.mbzyxkzh,d.gczyxkzh,d.gczyjb,d.postpone_number, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks ,s.dept_name from t_jobticket d
       left join sys_dept s on s.dept_id = d.dept_id
     </sql>
 
@@ -62,11 +63,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="mbzyxkzh != null  and mbzyxkzh != ''"> and mbzyxkzh = #{mbzyxkzh}</if>
             <if test="gczyxkzh != null  and gczyxkzh != ''"> and gczyxkzh = #{gczyxkzh}</if>
             <if test="gczyjb != null  and gczyjb != ''"> and gczyjb = #{gczyjb}</if>
+            <if test="postponeNumber != null "> and postpone_number = #{postponeNumber}</if>
             and d.del_flag = 0
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
-        order by d.kprq desc
+        order by d.kprq  desc,d.createdate desc
     </select>
 
     <select id="selectTJobticketById" parameterType="Long" resultMap="TJobticketResult">
@@ -113,6 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="mbzyxkzh != null">mbzyxkzh,</if>
             <if test="gczyxkzh != null">gczyxkzh,</if>
             <if test="gczyjb != null">gczyjb,</if>
+            <if test="postponeNumber != null">postpone_number,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -148,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="mbzyxkzh != null">#{mbzyxkzh},</if>
             <if test="gczyxkzh != null">#{gczyxkzh},</if>
             <if test="gczyjb != null">#{gczyjb},</if>
+            <if test="postponeNumber != null">#{postponeNumber},</if>
          </trim>
     </insert>
 
@@ -186,6 +190,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="mbzyxkzh != null">mbzyxkzh = #{mbzyxkzh},</if>
             <if test="gczyxkzh != null">gczyxkzh = #{gczyxkzh},</if>
             <if test="gczyjb != null">gczyjb = #{gczyjb},</if>
+            <if test="postponeNumber != null">postpone_number = #{postponeNumber},</if>
         </trim>
         where id = #{id}
     </update>

+ 2 - 2
master/src/main/resources/mybatis/invoice/TInvoiceBookingworkticketMapper.xml

@@ -122,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createdate != null "> and to_char(b.createdate, 'yyyy-mm-dd') = to_char(#{createdate}, 'yyyy-mm-dd')</if>
             <if test="updaterCode != null "> and updater_code = #{updaterCode}</if>
             <if test="updatedate != null "> and updatedate = #{updatedate}</if>
-            <if test="workType != null "> and work_type = #{workType}</if>
+            <if test="workType != null "> and FIND_IN_SET (#{workType},d.work_type) >0</if>
         <!--   &lt;!&ndash; <if test="riskLevel != null "> and risk_level = #{riskLevel}</if>&ndash;&gt;
             <if test="workDescription != null  and workDescription != ''"> and work_description = #{workDescription}</if>
             <if test="workPeopleNumber != null "> and work_people_number = #{workPeopleNumber}</if>
@@ -133,7 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptId != null "> and dept_id = #{deptId}</if>-->
             <if test="workUnit != null and workUnit != ''"> and b.work_unit = #{workUnit}</if>
             <if test="workArea != null and workArea != ''"> and b.work_area = #{workArea}</if>
-            <if test="floorLocation != null and floorLocation != ''"> and b.floor_location = #{floorLocation}</if>
+            <if test="floorLocation != null and floorLocation != ''"> and FIND_IN_SET (#{floorLocation},b.floor_location) >0</if>
             <if test="workStartTime != null "> and b.work_start_time = #{workStartTime}</if>
             <if test="workEndTime != null "> and b.work_end_time = #{workEndTime}</if>
             <if test="contact != null  and contact != ''"> and b.contact = #{contact}</if>

BIN
master/src/main/resources/static/word/invoice/book.docx


+ 9 - 0
ui/src/api/ehs/jobticket.js

@@ -60,3 +60,12 @@ export function exportJobticket(query) {
     params: query
   })
 }
+
+// 批量新增工作票
+export function batchAddJobticket(data) {
+  return request({
+    url: '/ehs/jobticket/batchAddJobticket',
+    method: 'post',
+    data: data
+  })
+}

+ 107 - 13
ui/src/views/ehs/jobticket/index.vue

@@ -123,9 +123,8 @@
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="jobticketList" @selection-change="handleSelectionChange" :height="clientHeight" border>
+    <el-table v-loading="loading" :data="jobticketList" @selection-change="handleSelectionChange" :height="clientHeight" border :cell-style="myclass">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column :label="$t('装置名称')" align="center" prop="plantCode" :formatter="plantCodeFormat" />
       <el-table-column :label="$t('开票日期')" align="center" prop="kprq" width="100">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.kprq, '{y}-{m}-{d}') }}</span>
@@ -142,6 +141,9 @@
       <el-table-column :label="$t('动火作业许可证号')" align="center" prop="dhzyxkzh" width="100" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('火票级别')" align="center" prop="hpjb" :formatter="hpjbFormat" />
       <el-table-column :label="$t('限制空间许可证号')" align="center" prop="xzkjxkzh" :show-overflow-tooltip="true"/>
+       <el-table-column label="盲板作业许可证号" align="center" prop="mbzyxkzh" :show-overflow-tooltip="true"/>
+      <el-table-column label="高处作业许可证号" align="center" prop="gczyxkzh" :show-overflow-tooltip="true"/>
+      <el-table-column label="高处作业级别" align="center" prop="gczyjb" :formatter="gczyjbFormat"/>
       <el-table-column :label="$t('BYC负责单位/联系人')" align="center" prop="byclxr" width="100" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('联系人')" align="center" prop="lxr" :show-overflow-tooltip="true"/>
       <el-table-column :label="$t('联系电话')" align="center" prop="lxdh" width="100" :show-overflow-tooltip="true"/>
@@ -160,7 +162,7 @@
         </template>
       </el-table-column>
       <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
-      <el-table-column :label="$t('操作')" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
+      <el-table-column :label="$t('操作')" align="center" fixed="right" width="160" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -176,6 +178,14 @@
             @click="handleDelete(scope.row)"
             v-hasPermi="['ehs:jobticket:remove']"
           >{{ $t('删除') }}</el-button>
+           <el-button
+           v-if="scope.row.xpxp=='10'"
+            size="mini"
+            type="text"
+            icon="el-icon-date"
+            @click="handlePostpone(scope.row)"
+            v-hasPermi="['ehs:jobticket:add']"
+          >{{ $t('延期') }}</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -191,16 +201,6 @@
     <!-- 添加或修改工作票对话框 -->
     <el-dialog v-dialogDrag :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item :label="$t('装置名称')" prop="plantCode">
-          <el-select v-model="form.plantCode" :placeholder="$t('请选择') + $t('装置名称')">
-            <el-option
-              v-for="dict in plantCodeOptions"
-              :key="dict.dictValue"
-              :label="dict.dictLabel"
-              :value="dict.dictValue"
-            ></el-option>
-          </el-select>
-        </el-form-item>
         <el-form-item :label="$t('开票日期')" prop="kprq">
           <el-date-picker clearable size="small" style="width: 200px"
             v-model="form.kprq"
@@ -370,6 +370,15 @@
         </el-col>
       </el-row>
     </el-drawer>
+     <el-dialog title="延期作业许可" :visible.sync="guanlianVisible" width="30%"  center>
+  <div class="demo-input-size">
+    <el-input   prop="yqzyxkzh"  size="medium" prefix-icon="el-icon-edit" placeholder="请输入延期作业许可证号" v-model="yqzyxkzh"></el-input>
+    </div>
+     <div slot="footer" class="dialog-footer">
+              <el-button @click="guanlianVisible=false">取 消</el-button>
+    <el-button type="primary" @click="submitPostpone()">确 定</el-button>
+          </div>
+</el-dialog>
   </div>
 </template>
 
@@ -386,6 +395,9 @@ export default {
   components: {FireData, Treeselect },
   data() {
     return {
+      //延期对话框
+      guanlianVisible:false,
+      yqzyxkzh:"",
       drawer: false,
       direction: 'rtl',
       // 遮罩层
@@ -419,6 +431,8 @@ export default {
       hpjbOptions: [],
       // 作业票状态字典
       zypztOptions: [],
+      // 高处作业级别字典
+      gczyjbOptions: [],
       // 用户导入参数
       upload: {
         //下载模板请求地址
@@ -499,6 +513,8 @@ export default {
       chooseDate: [],
       // 表单参数
       form: {},
+      //延期参数
+      postponeParams:{},
       // 表单校验
       rules: {
         plantCode: [
@@ -507,6 +523,9 @@ export default {
         deptId: [
           { required: true, message: this.$t('部门编号') + this.$t('不能为空'), trigger: "blur" }
         ],
+        yqzyxkzh: [
+          { required: true, message: this.$t('当前作业票已经延期五次,请重新生成新的续票'), trigger: "blur" }
+        ],
       }
     };
   },
@@ -538,8 +557,79 @@ export default {
     this.getDicts("ZYPZT").then(response => {
       this.zypztOptions = response.data;
     });
+    //高处作业级别
+    this.getDicts("GCZYJB").then(response => {
+      this.gczyjbOptions = response.data;
+    });
   },
   methods: {
+    //延期 即新增一条 改为续票
+    handlePostpone(row){
+      this.guanlianVisible=true
+       const id = row.id || this.ids
+       getJobticket(id).then(response => {
+        this.yqzyxkzh = response.data.yqxkzh;
+      });
+       this.postponeParams=row
+    
+    },
+    //新的 续票 构造票号 最多五次
+    submitPostpone(){
+   this.guanlianVisible=false
+   //保留新票的参数 用来修改新票
+   const id =this.postponeParams.id
+     const postponeNumber=this.postponeParams.postponeNumber+1;
+      const  yqxkzh=this.postponeParams.yqxkzh
+       //续票的参数
+       this.postponeParams.id=null
+       this.postponeParams.yqxkzh=this.yqzyxkzh
+       this.postponeParams.xpxp="12"
+       
+       if(postponeNumber>15){
+       return  this.msgError("当前作业票最多可以延期十五次,请重新开票");
+       }else{
+
+        if(this.postponeParams.yqxkzh.endsWith('-6')){
+            this.msgError("每张续票最多可以延期五次,请重新命名生成新的续票");
+                this.getList();
+        }else{
+          //若果是第一次延期  延期许可证取输入的 后续的都是原来
+          let putData={}
+          putData.id=id
+          putData.postponeNumber=postponeNumber
+          if(putData.postponeNumber==1){
+            putData.yqxkzh=this.yqzyxkzh.substring(0, this.yqzyxkzh.indexOf("-"));
+          }else{
+            putData.yqxkzh=yqxkzh
+          }
+               updateJobticket(putData).then(response => {
+              
+            });
+           addJobticket(this.postponeParams).then(response => {
+              this.msgSuccess(this.$t('延期成功,请查看新的续票'));
+              this.open = false;
+              this.getList();
+            });
+
+        }
+       }
+      
+    },
+      //修改单元格样式的方法
+    myclass({ row, column, rowIndex, columnIndex }) {
+      if ( row.zypzt == 10){
+        return "background-color:rgba(255,63,0, 0.6);"
+      }
+      if ( row.zypzt == 18||row.zypzt==14){
+        return "background-color:rgba(21,180,51, 0.6);"
+      }
+      if (row.zypzt == 16){
+        return "background-color:rgba(221,248,9, 0.6);"
+      }
+      if (row.zypzt == 20){
+        return "background-color:rgba(255, 68,68, 0.6);"
+      }
+    },
     /** 查询工作票列表 */
     getList() {
       this.loading = true;
@@ -575,6 +665,10 @@ export default {
     zypztFormat(row, column) {
       return this.selectDictLabel(this.zypztOptions, row.zypzt);
     },
+    // 高处作业级别字典翻译
+    gczyjbFormat(row, column) {
+      return this.selectDictLabel(this.gczyjbOptions, row.gczyjb);
+    },
     // 取消按钮
     cancel() {
       this.open = false;

+ 138 - 52
ui/src/views/invoice/bookingworkticket/index.vue

@@ -115,6 +115,7 @@
           type="success"
           icon="el-icon-copy-document"
           size="mini"
+          :disabled="multiple"
           @click="tickedStatis"
           v-hasPermi="['ehs:jobticket:add']"
         >作业票统计</el-button>
@@ -122,7 +123,7 @@
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="cancelQuery"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="bookingworkticketList" ref="multipleTable" class="table-fixed" :span-method="mergeMethod"  @selection-change="handleSelectionChange" :height="clientHeight" border>
+    <el-table v-loading="loading" :data="bookingworkticketList" ref="multipleTable" class="table-fixed" :span-method="mergeMethod"  @selection-change="handleSelectionChange" :height="clientHeight" border :row-key="getRowKey" >
       <el-table-column type="selection" width="55" align="center" :reserve-selection="true"/>
       <el-table-column label="作业单位" align="center" prop="bookingworkticket.workUnit" width="80" :show-overflow-tooltip="true"/>
       <el-table-column label="作业区域单元" align="center" prop="bookingworkticket.workArea" width="100" :show-overflow-tooltip="true"/>
@@ -151,7 +152,7 @@
         </template>
       </el-table-column>
       <el-table-column label="状态" align="center" prop="bookingworkticket.status" :formatter="statusFormat" />
-      <el-table-column label="票号"  align="center" prop="reservationNumber" width="160">
+      <el-table-column label="票号"  align="center" prop="reservationNumber" >
          <template slot-scope="scope">
          <span>  {{scope.row.reservationNumber}}</span>
           <el-button
@@ -166,11 +167,11 @@
  </el-table-column>
    <el-table-column label="危害工作许可证号" align="center" prop="whgzxkzh" :show-overflow-tooltip="true"/>
       <el-table-column label="动火作业许可证号" align="center" prop="dhzyxkzh" :show-overflow-tooltip="true"/>
-        <el-table-column label="火票级别" align="center" prop="hpjb" :show-overflow-tooltip="true"/>
+        <el-table-column label="火票级别" align="center" prop="hpjb" :formatter="hpjbFormat"/>
       <el-table-column label="限制空间许可证号" align="center" prop="xzkjxkzh" :show-overflow-tooltip="true"/>
       <el-table-column label="盲板作业许可证号" align="center" prop="mbzyxkzh" :show-overflow-tooltip="true"/>
       <el-table-column label="高处作业许可证号" align="center" prop="gczyxkzh" :show-overflow-tooltip="true"/>
-      <el-table-column label="高处作业级别" align="center" prop="gczyjb" :show-overflow-tooltip="true"/>
+      <el-table-column label="高处作业级别" align="center" prop="gczyjb" :formatter="gczyjbFormat"/>
       <el-table-column label="操作" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -383,14 +384,44 @@
 
     </el-dialog>
 
-      <el-dialog
-  title="关联票号"
-  :visible.sync="guanlianVisible"
-  width="30%"
-  center>
-  <div class="demo-input-size">
-    <el-input   size="medium" prefix-icon="el-icon-edit" placeholder="请输入票号" v-model="reservationNumber"></el-input>
-    </div>
+      <el-dialog  title="关联票号" :visible.sync="guanlianVisible" width="30%"  center>
+        <el-form  :model="licenseForm" :rules="rules" ref="licenseForm" label-width="100px" class="demo-ruleForm">
+   <el-form-item label="危害工作许可证号" prop="whgzxkzh">
+          <el-input v-model="licenseForm.whgzxkzh" placeholder="请输入危害工作许可证号" />
+        </el-form-item>
+        <el-form-item label="动火作业许可证号" prop="dhzyxkzh">
+          <el-input v-model="licenseForm.dhzyxkzh" placeholder="请输入动火作业许可证号" />
+        </el-form-item>
+         <el-form-item label="火票级别" prop="hpjb">
+          <el-select v-model="licenseForm.hpjb" clearable placeholder="请选择火票级别">
+           <el-option
+              v-for="dict in hpjbOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="限制空间许可证号" prop="xzkjxkzh">
+          <el-input v-model="licenseForm.xzkjxkzh" placeholder="请输入限制空间许可证号" />
+        </el-form-item>
+        <el-form-item label="盲板作业许可证号" prop="mbzyxkzh">
+          <el-input v-model="licenseForm.mbzyxkzh" placeholder="请输入盲板作业许可证号" />
+        </el-form-item>
+        <el-form-item label="高处作业许可证号" prop="gczyxkzh">
+          <el-input v-model="licenseForm.gczyxkzh" placeholder="请输入高处作业许可证号" />
+        </el-form-item>
+        <el-form-item label="高处作业级别" prop="gczyjb">
+          <el-select v-model="licenseForm.gczyjb" clearable placeholder="请选择高处作业级别">
+            <el-option
+            v-for="dict in gczyjbOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+             ></el-option>
+          </el-select>
+        </el-form-item>
+         </el-form>
      <div slot="footer" class="dialog-footer">
               <el-button @click="guanlianVisible=false">取 消</el-button>
     <el-button type="primary"    v-hasPermi="['invoice:bookingworkticket:edit']" @click="submitassociation">确 定</el-button>
@@ -418,6 +449,14 @@ export default {
   name: "Bookingworkticket",
   components: { Treeselect,AddApprove},
   data() {
+    var validatePass2 = (rule, value, callback) => {
+        if (value === ''|| value===null) {
+          callback(new Error('请至少输入一项'));
+        } else {
+         
+          callback();
+        }
+      };
     return {
       //关联票号
       associationParams:{},
@@ -453,12 +492,8 @@ export default {
       clientHeight:300,
         // 状态字典
       statusOptions: [],
-      // 作业单位字典
-      workUnitOptions: [],
       // 作业区域字典
       workAreaOptions: [],
-      // 单元号字典
-      unitNumberOptions: [],
       // 楼层字典
       floorLocationOptions: [],
        // 用户单位字典
@@ -469,9 +504,10 @@ export default {
       workTypeOptions: [],
         // 风险等级字典
       riskLevelOptions: [],
-        // 监护人单位字典
-      guardianUnitOptions: [],
-
+        // 火票级别字典
+      hpjbOptions: [],
+      // 高处作业级别字典
+      gczyjbOptions: [],
       // 是否显示弹出层
       open: false,
         // 用户导入参数
@@ -523,7 +559,10 @@ export default {
       approveForm:{},
       // 表单参数
       form: {  },
+      //预约票参数
        ruleForm: [{} ],
+       //许可证表单参数
+       licenseForm:{},
          flag: true,
       // 表单校验
       rules: {
@@ -560,6 +599,9 @@ export default {
         estimateWorktime: [
           { required: true, message: "预计作业时间不能为空", trigger: "change" }
         ],
+        gczyxkzh: [
+          { validator: validatePass2, trigger: 'blur'  }
+        ],
       }
     };
   },
@@ -581,7 +623,6 @@ export default {
        this.getTreeselect();
         //初始化作业区域、 初始化用户单位下拉框
         this.getDeviceup();
-     //   this.getOneCategorys();
       this.getDicts("booking_work_status").then(response => {
       this.statusOptions = response.data;
     });
@@ -597,12 +638,26 @@ export default {
     this.getDicts("book_risk_level").then(response => {
       this.riskLevelOptions = response.data;
     });
+    this.getDicts("HPJB").then(response => {
+      this.hpjbOptions = response.data;
+    });
+    this.getDicts("GCZYJB").then(response => {
+      this.gczyjbOptions = response.data;
+    });
 
   },
   methods: {
+    //得到行key
+    getRowKey(row) {
+      return row.guid;
+   },
     //作业票统计
     tickedStatis(){
-        console.log(this.$refs.multipleTable.selection);
+        let putData=this.$refs.multipleTable.selection
+
+        batchAddJobticket(putData).then(response => {
+       this.msgSuccess(this.$t('带入数据到工作票统计页面成功'));
+      });
     },
     //根据用户单位 查询对应选择的用户主管  根据用户单位 字段 查找对应的多个主管 返回 Sysuser的集合(id,name)
         checkCategoryPromotion(oneId){
@@ -764,39 +819,43 @@ export default {
               this.deptOptions = response.data;
           });
      },
- // 状态字典翻译
+ // 预约票状态字典翻译
     statusFormat(row, column) {
       return this.selectDictLabel(this.statusOptions, row.bookingworkticket.status);
     },
-    // 字典翻译
-    workUnitFormat(row, column) {
-      return this.selectDictLabel(this.workUnitOptions, row.workUnit);
-    },
-    // 字典翻译
+    // 工作区域字典翻译
     workAreaFormat(row, column) {
       return this.selectDictLabel(this.workAreaOptions, row.bookingworkticket.workArea);
     },
-    // 字典翻译
+    // 楼层位置字典翻译
     floorLocationFormat(row, column) {
 
       return this.selectDictLabels(this.floorLocationOptions, row.bookingworkticket.floorLocation);
     },
-     // 字典翻译
+     // 用户主管字典翻译
     userMgFormat(row, column) {
       return this.selectDictLabel(this.userMgOptions, row.userMg);
     },
-    // 字典翻译
+    // 用户单位字典翻译
     userUnitFormat(row, column) {
       return this.selectDictLabel(this.userUnitOptions, row.userUnit);
     },
-    // 字典翻译
+    // 作业类型字典翻译
     workTypeFormat(row, column) {
       return this.selectDictLabels(this.workTypeOptions, row.workType);
     },
-    // 字典翻译
+    // 风险等级字典翻译
     riskLevelFormat(row, column) {
       return this.selectDictLabel(this.riskLevelOptions, row.riskLevel);
     },
+    // 火票级别字典翻译
+    hpjbFormat(row, column) {
+      return this.selectDictLabel(this.hpjbOptions, row.hpjb);
+    },
+    // 高处作业级别字典翻译
+    gczyjbFormat(row, column) {
+      return this.selectDictLabel(this.gczyjbOptions, row.gczyjb);
+    },
 
     // 取消按钮
     cancel() {
@@ -864,6 +923,7 @@ export default {
       this.ids = selection.map(item => item.bookingticketId)
       this.single = selection.length!==1
       this.multiple = !selection.length
+     // console.log(selection)
     },
     /** 新增按钮操作 */
     handleAdd() {
@@ -970,22 +1030,6 @@ export default {
              // console.log(this.form)
            //   console.log(this.ruleForm)
             this.approveForm.invoiceId=response.data
-            var nowTime = this.getNowFormatDate()
-
-             //判断是否涉及 动火 和当日
-            // if ( this.form.workStartTime &&  this.form.workStartTime ===  nowTime){
-            //   this.approveForm.isToday = 1;
-            // }else{
-            //        this.approveForm.isToday = 0;
-            // }
-              // for (let i = 0; i < this.ruleForm.length; i++) {
-              //   if (this.ruleForm[i].workType === 1 || this.ruleForm[i].workType === 15) {
-              //     this.approveForm.isSpecial = 1
-              //     break;
-              //   } else {
-              //     this.approveForm.isSpecial = 0
-              //   }
-              // }
              this.approveForm.userSupId=this.form.userMg
 
              addInvoice(this.approveForm).then(response => {
@@ -1040,15 +1084,34 @@ export default {
        this.guanlianVisible=true
        this.associationParams=row
        getWorkcontent(row.id).then(response => {
-           this.reservationNumber=response.data.reservationNumber
+           this.licenseForm=response.data
           });
       },
       //提交票号
        submitassociation(){
        this.guanlianVisible=false
       const putData={}
+      if(this.licenseForm.whgzxkzh!=null
+      ||this.licenseForm.whgzxkzh!=''
+      ||this.licenseForm.dhzyxkzh!=null
+      ||this.licenseForm.dhzyxkzh!=''
+      ||this.licenseForm.xzkjxkzh!=null
+      ||this.licenseForm.xzkjxkzh!=''
+      ||this.licenseForm.mbzyxkzh!=null
+      ||this.licenseForm.mbzyxkzh!=''
+      ||this.licenseForm.gczyxkzh!=null||this.licenseForm.gczyxkzh!=''){
       putData.id=this.associationParams.id
-      putData.reservationNumber=this.reservationNumber
+      putData.whgzxkzh=this.licenseForm.whgzxkzh
+      putData.hpjb=this.licenseForm.hpjb
+      putData.dhzyxkzh=this.licenseForm.dhzyxkzh
+      putData.xzkjxkzh=this.licenseForm.xzkjxkzh
+      putData.mbzyxkzh=this.licenseForm.mbzyxkzh
+      putData.gczyxkzh=this.licenseForm.gczyxkzh
+      putData.gczyjb=this.licenseForm.gczyjb
+      }else{
+        return  this.msgError("请至少关联一张许可证号");
+      }
+  
        updateWorkcontent(putData).then(response => {
           //    console.log(response.row)
 
@@ -1079,6 +1142,30 @@ export default {
             rowspan: _row,
             colspan: _col
           };
+        }
+        if (columnIndex === 3) {
+          const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
+          const _col = _row > 0 ? 1 : 0;
+          return {
+            rowspan: _row,
+            colspan: _col
+          };
+        }
+        if (columnIndex === 4) {
+          const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
+          const _col = _row > 0 ? 1 : 0;
+          return {
+            rowspan: _row,
+            colspan: _col
+          };
+        }
+        if (columnIndex === 5) {
+          const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
+          const _col = _row > 0 ? 1 : 0;
+          return {
+            rowspan: _row,
+            colspan: _col
+          };
         }
          if (columnIndex === 11) {
           const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
@@ -1112,7 +1199,7 @@ export default {
             colspan: _col
           };
         }
-        if (columnIndex === 16) {
+        if (columnIndex === 23) {
           const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
           const _col = _row > 0 ? 1 : 0;
           return {
@@ -1120,7 +1207,6 @@ export default {
             colspan: _col
           };
         }
-
       },
       //单元格整理
         setTable(tableData) {