print打印许可证

This commit is contained in:
shijing 2023-03-10 17:24:17 +08:00
parent d07962189d
commit d2e76f4220
5 changed files with 393 additions and 377 deletions

View File

@ -2,313 +2,199 @@
<!--基本信息!-->
<el-main v-loading="mainLoading">
<div id="exportDiv" class="exportDiv">
<p class="tables-title">作业信息</p>
<el-card shadow="hover">
<el-descriptions title="许可证信息" column=2>
<el-descriptions-item label="编号:">
{{ form.number }}
</el-descriptions-item>
<el-descriptions-item label="作业级别:">
{{ form.level }}
</el-descriptions-item>
<el-descriptions-item label="预计开始:">
{{ form.start_time }}
</el-descriptions-item>
<el-descriptions-item label="预计结束:">
{{ form.end_time }}
</el-descriptions-item>
<el-descriptions-item label="状态:">
<span v-if="form.ticket_&&form.ticket_.state_" style="margin-right: 5px;">{{form.ticket_.state_.name }}</span>
<el-tag
v-if="form.ticket_&&form.ticket_.act_state"
:type="form.ticket_.act_state===0?'':form.ticket_.act_state===1?'':form.ticket_.act_state===2?'danger':form.ticket_.act_state===3?'danger':form.ticket_.act_state===5?'danger':form.ticket_.act_state===4?'success':''"
>{{act_states[form.ticket_.act_state]}}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="作业部门:">
<span v-if="form.dept_do_">{{
form.dept_do_.name
}}</span>
</el-descriptions-item>
<el-descriptions-item label="作业负责人:">
<span v-if="form.charger_">{{
form.charger_.name
}}</span>
</el-descriptions-item>
<el-descriptions-item label="作业监护人:">
<span v-if="form.monitor_">{{
form.monitor_.name
}}</span>
</el-descriptions-item>
<el-descriptions-item label="风险分析:" span=2>
<span v-for="item in form.risks_checked_" :key="item.id">{{
item.name
}}<el-divider direction="vertical"></el-divider></span>
</el-descriptions-item>
<el-descriptions-item label="控制措施:" span=2>
<span v-for="item in form.measures_checked_" :key="item.id">{{
item.name
}}<el-divider direction="vertical"></el-divider></span>
</el-descriptions-item>
<el-descriptions-item label="监控状态:" span=2>
<span v-if="form.mtask_uid">进行中</span>
</el-descriptions-item>
<el-descriptions column=2>
<el-descriptions-item label="作业名称:">
{{ operationObj.name }}
</el-descriptions-item>
<el-descriptions-item label="作业区域:">
<span v-if="operationObj.area_">
{{ operationObj.area_.name }}
</span>
</el-descriptions-item>
<el-descriptions-item label="生产状态:">
{{ operationObj.state_work }}
</el-descriptions-item>
<el-descriptions-item label="状态:">
{{ state_[operationObj.state] }}
</el-descriptions-item>
<el-descriptions-item label="预计开始:">
{{ operationObj.start_time }}
</el-descriptions-item>
<el-descriptions-item label="预计结束:">
{{ operationObj.end_time }}
</el-descriptions-item>
<el-descriptions-item label="属地部门:">
<span v-if="operationObj.dept_ter_">
{{operationObj.dept_ter_.name}}
</span>
</el-descriptions-item>
<el-descriptions-item label="业务部门:">
<span v-if="operationObj.dept_bus_">
{{operationObj.dept_bus_.name}}
</span>
</el-descriptions-item>
<el-descriptions-item label="协调员:">
<span v-if="operationObj.coordinator_">
{{operationObj.coordinator_.name}}
</span>
</el-descriptions-item>
<el-descriptions-item label="监控设备:" v-if="operationObj.vchannels">
<span v-for="item in operationObj.vchannels_" :key="item.id">
{{ item.name}}({{item.code}})/
</span>
</el-descriptions-item>
</el-descriptions>
</el-card>
<!-- <el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="110px"
style="margin: 10px 20px 0 20px"
>
<el-row>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="关联作业:">
<span>{{form.name}}</span>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业许可种类:">
<span>{{pagtitle}}</span>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业开始时间:">
<span>{{form.start_time}}</span>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业结束时间:">
<span>{{form.end_time}}</span>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业级别:">
<el-select v-model="form.level" placeholder="选择作业级别">
<el-option
v-for="item in leveloptions"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业部门:">
<el-cascader
placeholder="选择作业部门"
getCheckedNodes="true"
v-model="form.dept_do"
:options="deptoptions"
:props="{
expandTrigger: 'hover', //
label: 'label', //
value: 'value', //
emitPath: false, // false
}"
clearable
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业负责人:">
<el-select v-model="form.charger" placeholder="选择作业负责人">
<el-option
v-for="item in useroptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业监护人:">
<el-select v-model="form.monitor" placeholder="选择作业监护人">
<el-option
v-for="item in useroptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="风险选择:">
<el-checkbox-group v-model="form.risks_checked" disabled>
<el-checkbox
v-show="form.risks_checked.indexOf(item.id)>-1"
v-for="(item, index) in risklist"
:key="index"
:label="item.id"
>{{ item.name }}
</el-checkbox
>
</el-checkbox-group>
</el-form-item>
</el-col>
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="其他风险:">
<span>{{form.other_risk}}</span>
</el-form-item>
</el-col>
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="措施选择:">
<el-checkbox-group v-model="form.measures_checked" disabled>
<el-checkbox
v-show="form.measures_checked.indexOf(item.id)>-1"
v-for="(item, index) in measurelist"
:key="index"
:label="item.id"
>{{ item.name }}
</el-checkbox
>
</el-checkbox-group>
</el-form-item>
</el-col>
<el-col :md="24" :sm="12" :xs="24">
<el-card class="box-card">
<div class="clearfix">
<span>应急处置</span>
</div>
<div class="content">
<p>1发生火灾时立即使用消防器材边灭火边报告</p>
<p>2预判火势无法控制时应立即疏散人群并拨打110或119求救</p>
<p>
3发生人员烫伤时用清水对烫伤部位进行冲洗或浸泡用干净的纱布或衣物盖住被烫伤部位伤势严重时立即拨打120送医若贴身衣服与伤口粘在一起时可用剪刀剪开然后缓慢剥离衣物
</p>
</div>
</el-card>
<el-form-item label="其他应急处置:">
<span>{{form.other_emr}}</span>
</el-form-item>
</el-col>
</el-row>
</el-form> -->
<el-card header="作业人员" style="margin-top:8px" shadow="hover">
<scTable
ref="workerTable"
:data="workerData"
row-key="id"
hidePagination
stripe
hideDo
style="height: calc(100% - 60px);"
>
<el-table-column
label="#"
fixed="left"
type="index"
width="50"
></el-table-column>
<el-table-column label="姓名" prop="name" width="150">
<template #default="scope">
{{ scope.row.worker_.name }}
</template>
</el-table-column>
<el-table-column label="工作职责" prop="duty" width="150">
</el-table-column>
<el-table-column label="证书" prop="certificates" width="150">
<template #default="scope">
<el-tag v-for="item in scope.row.certificates_"
:key="item.number"
:label="item.name"
:value="item.number">{{item.name}}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
width="150"
></el-table-column>
<!-- <el-table-column label="操作" fixed="right" align="center" width="100">
<template #default="scope">
<el-button text type="primary" size="small" @click="bltHandle(scope.row,'1')">绑卡</el-button>
<el-button text type="primary" size="small" @click="bltHandle(scope.row,'0')">解绑</el-button>
</template>
</el-table-column> -->
</scTable>
</el-card>
<el-card header="气体检测记录" style="margin-top: 8px" shadow="hover" v-show="oplcateCode=='fire'||oplcateCode=='space'||oplcateCode=='cooler'">
<scTable
ref="gasTable"
:data="gasData"
row-key="id"
hidePagination
stripe
hideDo
>
<el-table-column
label="#"
type="index"
width="50"
></el-table-column>
<el-table-column
label="检测部位"
prop="check_place"
min-width="150"
></el-table-column>
<el-table-column label="O2(%)" prop="o2" min-width="120"></el-table-column>
<el-table-column label="CO" prop="co" min-width="120"></el-table-column>
<el-table-column
label="可燃气体(V%LEL)"
prop="lel"
min-width="150"
></el-table-column>
<el-table-column
label="检验结论"
prop="is_ok"
min-width="150"
>
<template #default="scope">
{{ is_ok_[scope.row.is_ok] }}
</template>
</el-table-column>
<el-table-column
label="检测人"
prop="checker"
min-width="150"
>
<template #default="scope">
{{ scope.row.checker_.name }}
</template>
</el-table-column>
<el-table-column
label="检测时间"
prop="check_time"
min-width="150"
></el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
min-width="150"
></el-table-column>
</scTable>
<p class="tables-title">许可证信息</p>
<el-card shadow="hover">
<el-descriptions column=2>
<el-descriptions-item label="编号:">
{{ form.number }}
</el-descriptions-item>
<el-descriptions-item label="作业级别:">
{{ form.level }}
</el-descriptions-item>
<el-descriptions-item label="开始时间:">
{{ form.start_time }}
</el-descriptions-item>
<el-descriptions-item label="结束时间:">
{{ form.end_time }}
</el-descriptions-item>
<el-descriptions-item label="状态:">
<span v-if="form.ticket_&&form.ticket_.state_" style="margin-right: 5px;">{{form.ticket_.state_.name }}</span>
<span :class="[form.ticket_.act_state===0?'nomalState':form.ticket_.act_state===1?'nomalState':form.ticket_.act_state===2?'dangerState':form.ticket_.act_state===3?'dangerState':form.ticket_.act_state===5?'dangerState':form.ticket_.act_state===4?'successState':'nomalState']"
v-if="form.ticket_&&form.ticket_.act_state">{{act_states[form.ticket_.act_state]}}</span>
</el-descriptions-item>
<el-descriptions-item label="作业部门:">
<span v-if="form.dept_do_">
{{form.dept_do_.name}}
</span>
</el-descriptions-item>
<el-descriptions-item label="作业负责人:">
<span v-if="form.charger_">
{{form.charger_.name}}
</span>
</el-descriptions-item>
<el-descriptions-item label="作业监护人:">
<span v-if="form.monitor_">
{{form.monitor_.name}}
</span>
</el-descriptions-item>
<el-descriptions-item label="风险分析:" span=2>
<span v-for="item in form.risks_checked_" :key="item.id">
{{item.name}}<el-divider direction="vertical"></el-divider>
</span>
</el-descriptions-item>
<el-descriptions-item label="控制措施:" span=2>
<span v-for="item in form.measures_checked_" :key="item.id">
{{item.name}}<el-divider direction="vertical"></el-divider>
</span>
</el-descriptions-item>
<el-descriptions-item label="监控状态:" span=2 v-if="form.mtask_uid">
<span>进行中</span>
</el-descriptions-item>
</el-descriptions>
</el-card>
<!-- <p class="tables-title" v-if="ticketDetailState">进度流程</p>
<el-card shadow="hover" v-if="ticketDetailState">
<work-step v-if="ticketDetail.state" ref="workStep" :ticket="ticketDetail"></work-step>
</el-card> -->
<p class="tables-title">作业人员</p>
<table class="tables" cellspacing="0">
<tr class="tableTh">
<td class="tableTd">序号</td>
<td class="tableTd">姓名</td>
<td class="tableTd">工作职责</td>
<td class="tableTd">证书</td>
<td class="tableTd">创建时间</td>
</tr>
<tr v-if="workerData.length==0" class="noDataTr"> 无检查数据</tr>
<tr class="tableTr" v-for="(item,index) in workerData" :key="item.id">
<td class="tableTd">{{ index+1 }}</td>
<td class="tableTd">{{ item.worker_.name }}</td>
<td class="tableTd">{{ item.duty }}</td>
<td class="tableTd">
<span v-for="cer in item.certificates_" :key="cer.number">{{cer.name}}</span>
</td>
<td class="tableTd">{{ item.create_time }}</td>
</tr>
</table>
<p class="tables-title">气体检测记录</p>
<table class="tables" cellspacing="0">
<tr class="tableTh">
<td class="tableTd">序号</td>
<td class="tableTd">检测部位</td>
<td class="tableTd">O₂%</td>
<td class="tableTd">CO</td>
<td class="tableTd">可燃气体(V%LEL)</td>
<td class="tableTd">检验结论</td>
<td class="tableTd">检测人</td>
<td class="tableTd">检测时间</td>
<td class="tableTd">创建时间</td>
</tr>
<tr v-if="gasData.length==0" class="noDataTr"> 无检查数据</tr>
<tr class="tableTr" v-for="(item,index) in gasData" :key="item.id">
<td class="tableTd">{{ index+1 }}</td>
<td class="tableTd">{{ item.check_place }}</td>
<td class="tableTd">{{ item.o2 }}</td>
<td class="tableTd">{{item.co}}</td>
<td class="tableTd">{{ item.lel }}</td>
<td class="tableTd">{{ is_ok_[item.is_ok] }}</td>
<td class="tableTd">{{ item.checker_.name }}</td>
<td class="tableTd">{{ item.check_time }}</td>
<td class="tableTd">{{ item.create_time }}</td>
</tr>
</table>
<p class="tables-title">处理日志</p>
<table class="tables" cellspacing="0">
<tr class="tableTh">
<td class="tableTd">进行状态</td>
<td class="tableTd">操作类型</td>
<td class="tableTd">操作属性</td>
<td class="tableTd">操作意见</td>
<td class="tableTd">操作人</td>
<!-- <td class="tableTd">电子签名</td> -->
<td class="tableTd">更新时间</td>
</tr>
<tr v-if="logsData.length==0" class="noDataTr"> 无处理日志</tr>
<tr class="tableTr" v-for="item in logsData" :key="item.id">
<td class="tableTd">{{ item.state_.name }}</td>
<td class="tableTd">{{ typeOptions[item.intervene_type] }}</td>
<td class="tableTd">
<span v-if="item.transition_attribute == 1" class="successState">同意</span>
<span v-else class="dangerState">拒绝</span>
</td>
<td class="tableTd">{{ item.suggestion }}</td>
<td class="tableTd">
<span v-if="item.participant_">{{item.participant_.name}}</span>
<span v-if="item.participant_str">{{item.participant_str}}</span>
</td>
<!-- <td class="tableTd">{{ item.electricName }}</td> -->
<td class="tableTd">{{ item.update_time }}</td>
</tr>
</table>
</div>
<div class="exportBtn" @click="handleExport">导出</div>
</el-main>
</template>
<script>
import PdfLoader from '@/utils/html2pdf';
import {genTree} from "@/utils/verificate";
import workStep from "./../../views/wf/steps.vue";
import PdfLoader from '@/utils/html2pdf';
export default {
name: "scFire",
components: {
workStep
},
props: {
id: { type: String, default: "" },
wfId: { type: String, default: "" },
},
data() {
return {
mainLoading: false,
active: 0,
stepSuc: [0],
stepTitle: ["基本信息", "作业人员", "气体检测记录"],
query: {},
selection: [],
issave: false, //
search: {
keyword: null,
@ -321,7 +207,7 @@ import PdfLoader from '@/utils/html2pdf';
cate: "",
risks_checked: [],
},
initForm: {},
ticketDetailState:false,
oplcateCode: 'fire',
operationId: "",
oplId: "",
@ -330,27 +216,23 @@ import PdfLoader from '@/utils/html2pdf';
{id: 20, name: "一级动火"},
{id: 30, name: "二级动火"},
],
deptoptions: [],
useroptions: [],
risklist: [],
measurelist: [],
pagtitle: "",
dutyOptions: [
{value: 10, label: "作业人员"},
{value: 20, label: "起重司机"},
{value: 30, label: "司索人员"},
{value: 40, label: "起重指挥"},
{value: 40, label: "电工"},
],
certificatesOptions: [],
ticketId:'',
ticketDetail:{},
operationObj:{},
workerData: [],
workerdialog: false,
gasdialog: false,
gasData: [],
logsData:[],
is_ok_: {
true: "正常",
false: "不正常",
},
state_: {
10: "创建中",
20: "审批中",
30: "待开始",
40: "进行中",
50: "已完成",
},
act_states: {
0: "草稿中",
1: "进行中",
@ -359,65 +241,79 @@ import PdfLoader from '@/utils/html2pdf';
4: "已完成",
5: "已关闭",
},
typeOptions: {
0: "正常处理",
1: "转交",
2: "加签",
3: "加签完成",
4: "接单",
5: "评论",
6: "删除",
7: "强制关闭",
8: "强制修改状态",
9: "hook",
10: "撤回",
11: "抄送",
},
};
},
mounted() {
let that = this;
that.oplId = that.id; //ID
that.operationId = that.wfId; //zuoyeID
this.$nextTick(()=>{
that.getOplData();
that.getworkerList();
that.getgasList();
that.getOperation();
})
let exportDiv = document.getElementById('exportDiv') // id
this.pdfDownLoader = new PdfLoader(exportDiv, '许可证', 'exportDiv') // fileName -->, question-table -->class
},
methods: {
handleExport() {
this.pdfDownLoader.outPutPdfFn('许可证')
// handleExport() {
// this.pdfDownLoader.outPutPdfFn('')
// },
handleExport(){
let bdHtml = window.document.body.innerHTML;
document.body.innerHTML = document.getElementById('exportDiv').innerHTML;
window.print();
},
//oplId
getOplData() {
this.mainLoading = true
this.$API.opm.opl.read.req(this.oplId).then((res) => {
this.mainLoading = false
this.form = res;
this.oplcateCode = res.cate_code
// this.oplcateId = res.cate;
// this.operationId = res.operation;
// this.getOperation();
// this.getOplcates();
let that = this;
that.mainLoading = true;
that.$API.opm.opl.read.req(that.oplId).then((res) => {
that.mainLoading = false
that.form = res;
that.oplcateCode = res.cate_code;
that.ticketId = res.ticket;
that.$nextTick(()=>{
// that.$API.wf.ticket.ticketItem.req(that.ticketId).then((ress) => {
// that.ticketDetail = ress;
// that.ticketDetailState = true;
// }).catch(e=>{});
this.$API.wf.ticket.ticketFlowlogs.req(that.ticketId).then((res) => {
if (res.err_msg) {
} else {
that.logsData = res;
}
});
})
}).catch(e=>{this.mainLoading=false});
},
// //ID===>
// getOplcates() {
// debugger;
// this.$API.opm.oplcate.read.req(this.oplcateId).then((res) => {
// console.log(res); //
// this.pagtitle = res.name;
// this.oplcateCode = res.code;
// this.risklist = res.risk_options_; //
// this.measurelist = res.measure_options_; //
// });
// },
// //operationId
// getOperation() {
// this.$API.opm.operation.read.req(this.operationId).then((res) => {
// this.form.start_time = res.start_time; //
// this.form.end_time = res.end_time; //
// this.form.name = res.name; //
// });
// },
// //
// getDept() {
// this.$API.system.dept.list.req({page: 0}).then((res) => {
// this.deptoptions = genTree(res);
// });
// },
// //
getOperation() {
this.mainLoading = true;
this.$API.opm.operation.read
.req(this.operationId)
.then((res) => {
this.mainLoading = false;
this.operationObj = res;
})
.catch((e) => {
this.mainLoading = false;
});
},
//
getworkerList() {
this.$API.opm.worker.list.req({opl: this.oplId, page: 0}).then((res) => {
@ -438,9 +334,71 @@ import PdfLoader from '@/utils/html2pdf';
.el-drawer__header {
margin-bottom: 0px;
}
.exportDiv{
padding-top: 20px;
.nomalState{
font-size: 12px;
padding: 0 9px;
color: #536dfe;
height: 24px;
line-height: 23px;
border-radius: 5px;
vertical-align: top;
display: inline-block;
background-color: #edf0fe;
border: 1px solid #dcdfe6;
}
.tables{
width: 100%;
color: #606266;
border-top: 1px solid #e4e7ed;
border-left: 1px solid #e4e7ed;
border-collapse: collapse;
}
.tables-title{
color: #303331;
font-size: 16px;
font-weight: 700;
margin: 20px 0 10px 0;
}
.tableTh,.tableTr{
display: flex;
}
.tableTh>td{
font-weight: 700;
color: #909399;
height: 35px;
line-height: 35px;
padding: 0 5px;
/* background: #fafafa; */
}
.tableTh>td:first-child{
flex-shrink:0;
width: 50px;
}
.tableTr>td{
min-height: 30px;
line-height: 30px;
padding: 0 5px;
}
.tableTr>td:first-child{
flex-shrink:0;
width: 50px;
}
td{
width: 25%;
border-right: 1px solid #e4e7ed;
border-bottom: 1px solid #e4e7ed;
}
.noDataTr{
text-align: center;
height: 50px;
line-height: 50px;
box-sizing: border-box;
border-bottom: 1px solid #e4e7ed;
border-right: 1px solid #e4e7ed;
}
/* .exportDiv{
padding-top: 20px;
} */
.exportBtn{
width: 120px;
height: 40px;

View File

@ -26,17 +26,17 @@ class PdfLoader {
const eleOffsetTop = ele.offsetTop// 获得该容器到文档顶部的距离
const eleOffsetLeft = ele.offsetLeft// 获得该容器到文档最左的距离
const canvas = document.createElement('canvas')
let abs = 0
const win_in = document.documentElement.clientWidth || document.body.clientWidth// 获得当前可视窗口的宽度(不包含滚动条)
const win_out = window.innerWidth// 获得当前窗口的宽度(包含滚动条)
if (win_out > win_in) {
abs = (win_out - win_in) / 2// 获得滚动条宽度的一半
}
// let abs = 0
// const win_in = document.documentElement.clientWidth || document.body.clientWidth// 获得当前可视窗口的宽度(不包含滚动条)
// const win_out = window.innerWidth// 获得当前窗口的宽度(包含滚动条)
// if (win_out > win_in) {
// abs = (win_out - win_in) / 2// 获得滚动条宽度的一半
// }
canvas.width = eleW * 2// 将画布宽&&高放大两倍
canvas.height = eleH * 2
const context = canvas.getContext('2d')
context.scale(2, 2) // 增强图片清晰度
context.translate(-eleOffsetLeft - abs, -eleOffsetTop)
context.scale(3, 3) // 增强图片清晰度
context.translate(-eleOffsetLeft , -eleOffsetTop)
html2canvas(ele, {
useCORS: true// 允许canvas画布内可以跨域请求外部链接图片, 允许跨域请求。
}).then(async canvas => {
@ -49,7 +49,7 @@ class PdfLoader {
// 页面偏移
let position = 0
// a4纸的尺寸[595,842],单位像素html页面生成的canvas在pdf中图片的宽高
const imgWidth = this.A4_WIDTH - 10 // -10为了页面有右边距
const imgWidth = this.A4_WIDTH - 40 // -10为了页面有右边距
const imgHeight = (this.A4_WIDTH / contentWidth) * contentHeight
const pageData = canvas.toDataURL('image/jpeg', 1.0)
const pdf = jsPDF('', 'pt', 'a4')
@ -57,8 +57,7 @@ class PdfLoader {
// 当内容未超过pdf一页显示的范围无需分页
if (leftHeight < pageHeight) {
// 在pdf.addImage(pageData, 'JPEG', 左,上,宽度,高度)设置在pdf中显示
pdf.addImage(pageData, 'JPEG', 5, 0, imgWidth, imgHeight)
// pdf.addImage(pageData, 'JPEG', 20, 40, imgWidth, imgHeight);
pdf.addImage(pageData, 'JPEG', 20, 20, imgWidth, imgHeight)
} else {
// 分页
while (leftHeight > 0) {
@ -115,6 +114,51 @@ class PdfLoader {
})
}
}
// export default {
// install(Vue, options) {
// Vue.prototype.getPdf = function(title) {
// var element = document.getElementById("pdfContent")
// var title = title; //PDF文件标题
// var c = document.createElement("canvas");//创建照片
// var opts = {
// scale: 2,
// canvas: c,
// logging: true,
// width: element.clientWidth,
// height: element.clientHeight
// };
// //照片高度和宽度是页面元素的两倍
// c.width = element.clientWidth * 2
// c.height = element.clientHeight * 2
// c.getContext("2d").scale(2, 2);
// html2Canvas(element, opts)
// .then(function(canvas) {
// let contentWidth = canvas.width
// let contentHeight = canvas.height
// let pageHeight = contentWidth / 592.28 * 841.89
// let leftHeight = contentHeight
// let position = 0
// let imgWidth = 595.28
// let imgHeight = 592.28 / contentWidth * contentHeight
// let pageData = canvas.toDataURL(image/jpeg, 1.0)
// let PDF = new JsPDF(, pt, a4)
// if (leftHeight < pageHeight) {
// //第一个20是img和pdf页面的左边距第二个20是img与pdf页面的上边距
// PDF.addImage(pageData, JPEG, 20, 20, imgWidth, imgHeight)
// } else {
// while (leftHeight > 0) {
// PDF.addImage(pageData, JPEG, 20, position, imgWidth, imgHeight)
// leftHeight -= pageHeight
// position -= 841.89
// if (leftHeight > 0) {
// PDF.addPage()
// }
// }
// }
// PDF.save(title + .pdf)
// })
// }
// }
// }
export default PdfLoader

View File

@ -230,7 +230,7 @@
text: '数据请求中,请稍后...',
background: 'rgba(0, 0, 0, 0)',
})
that.$API.hrm.employee.list.req({page:1,page_size:999,type__in:'employee,remployee',belong_dept:that.query.employee__belong_dept})
that.$API.hrm.employee.list.req({page:1,page_size:999,type__in:'employee,remployee',job_state:10,belong_dept:that.query.employee__belong_dept})
.then(res=>{
let promiseList = [];
let rowData1 = [],rowData2=[];
@ -253,9 +253,9 @@
let dateInd = new Date(recordList[j].create_time).getDate();
let dateIndex = parseInt(dateInd);
if(recordList[j].type==10){
rowData1[dateIndex+1] = '√-' + recordList[j].create_time.substring(11);
rowData1[dateIndex+1] = recordList[j].create_time.substring(11,16);
}else{
rowData2[dateIndex+1] = '√-' + recordList[j].create_time.substring(11);
rowData2[dateIndex+1] = recordList[j].create_time.substring(11,16);
}
}
tableData.push(rowData1);
@ -263,21 +263,30 @@
}
let ws = XLSX2.utils.aoa_to_sheet(tableData);
let wb = XLSX2.utils.book_new();
//
const font = {
name: '宋体',
sz: 12,
bold: true,
color: { rgb: '00000000' },
}
// const font = {
// name: '',
// sz: 12,
// bold: true,
// color: { rgb: '00000000' },
// }
//
const alignment = {
horizontal: 'center',
vertical: 'center',
}
// ws['A0'].s = {
// const alignment = {
// horizontal: 'center',
// vertical: 'center',
// }
// ws['B1'].s = {
// font,
// alignment,
// fill:{
// bgColor:{
// indexed:64
// },
// fgColor:{
// rgb:'#FFF000'
// }
// }
// }
// s start //r row 0 //c col 0
let cNumber = daysList.length-1;
@ -287,9 +296,9 @@
i++
}
ws['!merges'] = merge;
let closList = new Array(31).fill({wch: 2 });
let closList = new Array(31).fill({wch: 5});
closList.unshift({wch:8})
closList.unshift({wch:15})
closList.unshift({wch:10})
ws['!cols'] = closList;
XLSX2.utils.book_append_sheet(wb, ws, chartName); // 簿
XLSX2.writeFile(wb, chartName+'.xlsx'); //

View File

@ -87,7 +87,7 @@
</scTable>
</el-card>
<el-drawer :size="'50%'" v-model="showLimited" :title="oplName + '作业许可证详情'">
<sc-fire :id="oplId"></sc-fire>
<sc-fire :id="oplId" :wfId="operationId"></sc-fire>
</el-drawer>
</el-main>
</template>
@ -114,6 +114,7 @@ export default {
operationObj: {},
showLimited: false,
oplId: "",
operationId: "",
state_: {
10: "创建中",
20: "审批中",
@ -133,6 +134,7 @@ export default {
},
mounted() {
this.operationId = this.$route.query.id;
this.getoplcate();
this.getopllist();
this.getOperation();

View File

@ -28,7 +28,10 @@ export default {
},
mounted() {
// this.workId = this.ticket?this.ticket:this.$route.query.id;
this.workId = this.$route.query.id;
debugger;
console.log(this.ticket)
this.workId = this.ticket.id;
this.$route.query.id;
this.getFlowSteps();
},
methods: {