990 lines
28 KiB
Vue
990 lines
28 KiB
Vue
<template>
|
||
<view class="fullHeight" style="overflow: hidden;">
|
||
<headers :showBack="true" :themeType="'white'">
|
||
<view class="headerName">
|
||
人员档案
|
||
</view>
|
||
</headers>
|
||
<scroll-view scroll-y="true" class="pageContent">
|
||
<view class="personDetail_content">
|
||
<view class="title_wrap">
|
||
<text class="exit_status" v-if="workerInfo.inserviceType==2">已退场</text>
|
||
<view class="flex">
|
||
<view class="flex">
|
||
<image class="photograph" @click="previewImage(workerInfo.fieldAcquisitionUrl,1)"
|
||
:src="url_config+'image/'+workerInfo.fieldAcquisitionUrl"></image>
|
||
<image class="photograph" @click="previewImage(workerInfo.idCardBigPhotoUrl,2)"
|
||
:src="url_config+'image/'+workerInfo.idCardBigPhotoUrl"></image>
|
||
</view>
|
||
<view class="user_info">
|
||
<view class="name">{{workerInfo.workerName}}</view>
|
||
<view class="code">{{workerInfo.idCard}}</view>
|
||
<view class="nation">民族:{{workerInfo.nation}}</view>
|
||
<view class="nation">当前安全评分分值:{{workerInfo.safeScore || 0}}</view>
|
||
</view>
|
||
<!-- 操作按钮 -->
|
||
<view style="width: 30px;height: 60px; text-align: center;" v-if="false">
|
||
<image class="more" src="../../../../static/personManage/more.png" @click="operateBtn"></image>
|
||
</view>
|
||
</view>
|
||
<view class="projectName">{{workerInfo.projectName}}</view>
|
||
<view class="details-content" v-if="workerInfo.personType==1 && codeShow">
|
||
<view class="left-content">
|
||
<view class="project_info">
|
||
<text class="name">企业:</text>
|
||
<text>{{workerInfo.enterpriseName}}</text>
|
||
</view>
|
||
<view class="project_info">
|
||
<text class="name">班组:</text>
|
||
<text>{{workerInfo.teamName}}</text>
|
||
</view>
|
||
<!-- <view class="project_info">
|
||
<text class="name">工种:</text>
|
||
<text>顾燕安-中建八局第三建设有限公司安装分公司</text>
|
||
</view> -->
|
||
<view class="project_info">
|
||
<text class="name">工号:</text>
|
||
<text>{{workerInfo.attendanceNumber}}</text>
|
||
</view>
|
||
</view>
|
||
<tki-qrcode ref="qrcode" :size="120" cid="1001" :val="qrUrl" :background="backgroundColor"
|
||
:foreground="foregroundColor" :pdground="pdgroundColor" :onval="true" :loadMake="true" />
|
||
</view>
|
||
<view class="details-content" v-if="workerInfo.personType!=1 && codeShow">
|
||
<view class="left-content">
|
||
<view class="project_info">
|
||
<text class="name">企业:</text>
|
||
<text>{{workerInfo.enterpriseName}}</text>
|
||
</view>
|
||
<view class="project_info">
|
||
<text class="name">部门:</text>
|
||
<text>{{workerInfo.departmentName}}</text>
|
||
</view>
|
||
<view class="project_info">
|
||
<text class="name">工号:</text>
|
||
<text>{{workerInfo.attendanceNumber}}</text>
|
||
</view>
|
||
</view>
|
||
<tki-qrcode ref="qrcode" :size="120" cid="1001" :val="qrUrl" :background="backgroundColor"
|
||
:foreground="foregroundColor" :pdground="pdgroundColor" :onval="true" :loadMake="true" />
|
||
</view>
|
||
<image src="../../../../static/header_bg.png" class="header_bg"></image>
|
||
<view class="title_dialog" v-if="operateType">
|
||
<view @click="editPersonState(1)" v-if="workerInfo.inserviceType==2">再次进场</view>
|
||
<view @click="editPersonState(2)" v-if="workerInfo.inserviceType==1">退场</view>
|
||
</view>
|
||
</view>
|
||
<view class="item_wrap flex">
|
||
<view class="flex item" @click="showItemDetails(1)">
|
||
<image class="margin_r_5" style="width: 46rpx;height:46rpx"
|
||
src="../../../../static/personManage/ht.png"></image>
|
||
<text>劳动合同</text>
|
||
<text class="state1" style="top: -7px;left: 68px;" v-if="contractList.length>0">已签</text>
|
||
<text class="state2" style="top: -7px;left: 68px;" v-else>未签</text>
|
||
</view>
|
||
<view class="flex item" @click="showItemDetails(2)">
|
||
<image class="margin_r_5" style="width: 42rpx;height:42rpx"
|
||
src="../../../../static/personManage/tjzs.png"></image>
|
||
<text>体检</text>
|
||
<text class="state1" style="top: -7px;left: 40px;" v-if="physicalsList.length>0">已体检</text>
|
||
<text class="state2" style="top: -7px;left: 40px;" v-else>未体检</text>
|
||
</view>
|
||
<view class="flex item" @click="showItemDetails(3)">
|
||
<image class="margin_r_5" style="width: 38rpx;height:44rpx"
|
||
src="../../../../static/personManage/bx.png"></image>
|
||
<text>工伤保险</text>
|
||
</view>
|
||
<view class="flex item" @click="showItemDetails(4)">
|
||
<image class="margin_r_5" style="width: 43rpx;height:38rpx"
|
||
src="../../../../static/personManage/jy.png"></image>
|
||
<text>安全教育</text>
|
||
</view>
|
||
<view class="flex item" @click="uploadImage()" v-if="COMPANY == 'cpgs'">
|
||
<image class="margin_r_5" style="width: 43rpx;height:38rpx"
|
||
src="../../../../static/personManage/rl.png"></image>
|
||
<text>上传人脸</text>
|
||
</view>
|
||
<view class="flex item" @click="showItemDetails(5)" v-if="false">
|
||
<image class="margin_r_5" style="width: 35rpx;height:35rpx"
|
||
src="../../../../static/personManage/qrCode.png"></image>
|
||
<text>二维码</text>
|
||
</view>
|
||
<view class="flex item" @click="showItemDetails(6)" v-if="COMPANY == 'cpgs'">
|
||
<image class="margin_r_5" style="width: 40rpx;height:40rpx"
|
||
src="../../../../static/personManage/cyjl.png"></image>
|
||
<text>考勤录入</text>
|
||
</view>
|
||
</view>
|
||
<view class="log_wrap">
|
||
<view class="flex" @click="showInfoList(1)">
|
||
<view class="flex">
|
||
<image class="margin_r_5" style="width: 33rpx;height:40rpx"
|
||
src="../../../../static/personManage/zs.png"></image>
|
||
<text class="title">资格证书({{certificateList.length}})</text>
|
||
</view>
|
||
<view v-if="false">添加</view>
|
||
</view>
|
||
<view class="log_content" v-if="showCertificateList">
|
||
<view class="log_content_item" v-for="(item,index) in certificateList" :key="index">
|
||
<view>
|
||
<text>证书类型:</text>
|
||
<text>{{item.certificateTypeName}}</text>
|
||
</view>
|
||
<view>
|
||
<text>证书编号:</text>
|
||
<text>{{item.certificateNumber}}</text>
|
||
</view>
|
||
<view>
|
||
<text>技能等级:</text>
|
||
<text v-if="item.skillLevel==1">普工</text>
|
||
<text v-if="item.skillLevel==2">初级工</text>
|
||
<text v-if="item.skillLevel==3">中级工</text>
|
||
<text v-if="item.skillLevel==4">高级工</text>
|
||
<text v-if="item.skillLevel==5">技师</text>
|
||
<text v-if="item.skillLevel==6">高级技师</text>
|
||
</view>
|
||
<view>
|
||
<text>发证日期:</text>
|
||
<text>{{item.issueTime}}</text>
|
||
</view>
|
||
<view>
|
||
<text>截止日期:</text>
|
||
<text>{{item.effectTime}}</text>
|
||
</view>
|
||
<view>
|
||
<text>发证机关:</text>
|
||
<text>{{item.issueCompany}}</text>
|
||
</view>
|
||
<view class="flex">
|
||
<text>备注:</text>
|
||
<pre>{{item.remarks}}</pre>
|
||
</view>
|
||
<view class="flex3">
|
||
<text>附件:</text>
|
||
<image v-if="imgItem" v-for="(imgItem,imgIndex) in item.fileList"
|
||
@click="previewImage(imgItem.url,2)" :key="imgIndex"
|
||
:src="url_config+'image/'+imgItem.url" style="width: 40px; height: 50px;"></image>
|
||
</view>
|
||
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="log_wrap">
|
||
<view class="flex" @click="showInfoList(2)">
|
||
<view class="flex">
|
||
<image class="margin_r_5" style="width: 37rpx;height:37rpx"
|
||
src="../../../../static/personManage/cyjl.png"></image>
|
||
<text class="title">从业经历({{workExperienceList.length}})</text>
|
||
</view>
|
||
<view v-if="false">添加</view>
|
||
</view>
|
||
<view class="log_content" v-if="showWorkExperienceList">
|
||
<view class="log_content_item" v-for="(item,index) in workExperienceList" :key="index">
|
||
<view>
|
||
<text>参与项目:</text>
|
||
<text>{{item.projectName}}</text>
|
||
</view>
|
||
<view>
|
||
<text>入场日期:</text>
|
||
<text>{{item.enterDate}}</text>
|
||
</view>
|
||
<view>
|
||
<text>退场日期:</text>
|
||
<text>{{item.exitDate}}</text>
|
||
</view>
|
||
<view>
|
||
<text>工种:</text>
|
||
<text>{{item.typeName}}</text>
|
||
</view>
|
||
<view>
|
||
<text>班组/部门:</text>
|
||
<text>{{item.teamName}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="log_wrap">
|
||
<view class="flex" @click="showInfoList(3)">
|
||
<view class="flex">
|
||
<image class="margin_r_5" style="width: 34rpx;height:43rpx"
|
||
src="../../../../static/personManage/jl.png"></image>
|
||
<text class="title">奖励记录({{rewardList.length}})</text>
|
||
</view>
|
||
<view v-if="false">添加</view>
|
||
</view>
|
||
<view class="log_content" v-if="showRewardList">
|
||
<view class="log_content_item" v-for="(item,index) in rewardList" :key="index">
|
||
<view>
|
||
<text>发生时间:</text>
|
||
<text>{{item.eventTime}}</text>
|
||
</view>
|
||
<view>
|
||
<text>事件|奖励原因:</text>
|
||
<text>{{item.reason}}</text>
|
||
</view>
|
||
<view>
|
||
<text>奖励名称:</text>
|
||
<text>{{item.awardName}}</text>
|
||
</view>
|
||
<view class="flex">
|
||
<text>备注:</text>
|
||
<pre>{{item.remarks}}</pre>
|
||
</view>
|
||
<view class="flex3">
|
||
<text>附件:</text>
|
||
<image v-if="imgItem" v-for="(imgItem,imgIndex) in item.fileList"
|
||
@click="previewImage(imgItem.url,2)" :key="imgIndex"
|
||
:src="url_config+'image/'+imgItem.url" style="width: 40px; height: 50px;"></image>
|
||
</view>
|
||
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="log_wrap">
|
||
<view class="flex" @click="showInfoList(4)">
|
||
<view class="flex">
|
||
<image class="margin_r_5" style="width: 34rpx;height:34rpx"
|
||
src="../../../../static/personManage/bljl.png"></image>
|
||
<text class="title">不良记录({{badList.length}})</text>
|
||
</view>
|
||
<view v-if="false">添加</view>
|
||
</view>
|
||
<view class="log_content" v-if="showBadList">
|
||
<view class="log_content_item" v-for="(item,index) in badList" :key="index">
|
||
<view>
|
||
<text>发生时间:</text>
|
||
<text>{{item.eventTime}}</text>
|
||
</view>
|
||
<view>
|
||
<text>事件|发生原因:</text>
|
||
<text>{{item.reason}}</text>
|
||
</view>
|
||
<view>
|
||
<text>严重程度:</text>
|
||
<text>{{item.seriousGrade==1?'不严重':item.seriousGrade==2?'严重':item.seriousGrade==3?'非常严重':''}}</text>
|
||
</view>
|
||
<view class="flex">
|
||
<text>备注:</text>
|
||
<pre>{{item.remarks}}</pre>
|
||
</view>
|
||
<view class="flex3">
|
||
<text>附件:</text>
|
||
<image v-if="imgItem" v-for="(imgItem,imgIndex) in item.fileList" :key="imgIndex"
|
||
@click="previewImage(imgItem.url,2)" :src="url_config+'image/'+imgItem.url"
|
||
style="width: 40px; height: 50px;"></image>
|
||
</view>
|
||
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="log_wrap">
|
||
<view class="flex" @click="showInfoList(5)">
|
||
<view class="flex">
|
||
<image class="margin_r_5" style="width: 34rpx;height:34rpx"
|
||
src="../../../../static/personManage/zs.png"></image>
|
||
<text class="title">扣分记录({{reduceScoreList.length}})</text>
|
||
</view>
|
||
<view v-if="false">添加</view>
|
||
</view>
|
||
<view class="log_content" v-if="showReduceScoreList">
|
||
<view class="log_content_item" v-for="(item,index) in reduceScoreList" :key="index">
|
||
<view>
|
||
<text>序号:</text>
|
||
<text>{{index + 1}}</text>
|
||
</view>
|
||
<view>
|
||
<text>扣分时间:</text>
|
||
<text>{{item.createDate}}</text>
|
||
</view>
|
||
<view>
|
||
<text>扣分原因:</text>
|
||
<text>{{item.deductReason}}</text>
|
||
</view>
|
||
<view>
|
||
<text>当前安全评分值:</text>
|
||
<text>{{item.curScore}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="log_wrap" v-if="COMPANY == 'cpgs'">
|
||
<view class="flex" @click="showInfoList(6)">
|
||
<view class="flex">
|
||
<image class="margin_r_5" style="width: 34rpx;height:34rpx"
|
||
src="../../../../static/personManage/zs.png"></image>
|
||
<text class="title">考勤记录</text>
|
||
</view>
|
||
<view v-if="false">添加</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="kqbtn" v-if="btnAuth" @click="goTo">
|
||
辅助考勤
|
||
</view>
|
||
</scroll-view>
|
||
</view>
|
||
</template>
|
||
<script>
|
||
import tkiQrcode from "@/components/tki-qrcode/tki-qrcode.vue"
|
||
const uniImageCompress = require('uniapp-image-compress')
|
||
export default {
|
||
components: {
|
||
tkiQrcode,
|
||
},
|
||
data() {
|
||
return {
|
||
codeShow: false,
|
||
backgroundColor: '#fff',
|
||
foregroundColor: '#000',
|
||
pdgroundColor: '#000',
|
||
qrUrl: '此二维码仅供展示',
|
||
workerId: 0,
|
||
operateType: false,
|
||
originWorkerInfo: {}, // 原始基本信息
|
||
workerInfo: {}, //基本信息
|
||
certificateList: [], //资格证书
|
||
workExperienceList: [], //从业信息
|
||
reduceScoreList: [], // 扣分记录
|
||
badList: [], //不良记录
|
||
rewardList: [], //--奖励记录
|
||
contractList: [], //合同列表
|
||
physicalsList: [], //体检列表
|
||
safeEducationList: [], //安全教育信息
|
||
monthAttendance: [],
|
||
insuranceList: [],
|
||
|
||
showReduceScoreList: false,
|
||
showBadList: false,
|
||
showRewardList: false,
|
||
showWorkExperienceList: false,
|
||
showCertificateList: false,
|
||
btnAuth: false,
|
||
}
|
||
},
|
||
onLoad(options) {
|
||
this.workerId = options.id;
|
||
this.btnAuth = this.checkBtnPermission({
|
||
key: 'assist_attendance',
|
||
menuPath: '/project/labor/attendanceManage'
|
||
})
|
||
// this.getDetailsData();
|
||
},
|
||
onShow() {
|
||
this.getDetailsData();
|
||
this.getSafeScoreDetail();
|
||
},
|
||
methods: {
|
||
goTo() {
|
||
uni.navigateTo({
|
||
url: './assistCheckingIn?id=' + this.workerId
|
||
})
|
||
},
|
||
setCodeColor(fenshu) {
|
||
console.log(fenshu)
|
||
if (fenshu >= 80) {
|
||
this.foregroundColor = "green";
|
||
this.pdgroundColor = "green";
|
||
} else if (fenshu >= 60 && fenshu < 80) {
|
||
// this.fontColor = "rgb(255, 230, 0)";
|
||
this.foregroundColor = "#F7C409";
|
||
this.pdgroundColor = "#F7C409";
|
||
} else if (fenshu < 60) {
|
||
// this.fontColor = "red";
|
||
this.foregroundColor = "#F0212A";
|
||
this.pdgroundColor = "#F0212A";
|
||
}
|
||
this.codeShow = true;
|
||
},
|
||
// 生成台账数据
|
||
productRecord(obj) {
|
||
let that = this;
|
||
let requestData = {
|
||
enterpriseName: obj.enterpriseName,
|
||
personType: obj.personType == 1 ? '施工人员' : obj.personType == 2 ? '管理人员' : '临时人员',
|
||
teamDepartmentName: obj.teamName || obj.departmentName,
|
||
workerName: obj.workerName,
|
||
projectSn: obj.projectSn,
|
||
scanQrCoder: JSON.parse(uni.getStorageSync('userInfo')).account
|
||
}
|
||
if (obj.safeScore >= 80) {
|
||
requestData.accessStatus = 1;
|
||
} else if (obj.safeScore >= 60 && obj.safeScore < 80) {
|
||
requestData.accessStatus = 1;
|
||
} else if (obj.safeScore < 60) {
|
||
requestData.accessStatus = 2;
|
||
}
|
||
this.sendRequest({
|
||
url: 'xmgl/workerAccessRecord/add',
|
||
method: 'post',
|
||
data: {
|
||
...requestData
|
||
},
|
||
success: res => {}
|
||
})
|
||
},
|
||
// 获取安全扣分详情
|
||
getSafeScoreDetail() {
|
||
let that = this;
|
||
this.sendRequest({
|
||
url: 'xmgl/xzDeductScoreRecord/list',
|
||
method: 'get',
|
||
data: {
|
||
projectSn: JSON.parse(uni.getStorageSync('projectDetail')).projectSn,
|
||
workerId: this.workerId,
|
||
},
|
||
success: res => {
|
||
if (res.code == 200) {
|
||
that.reduceScoreList = res.result;
|
||
}
|
||
}
|
||
})
|
||
},
|
||
//获取详情数据
|
||
getDetailsData() {
|
||
this.sendRequest({
|
||
url: 'xmgl/workerInfo/viewWorkerInfoDetail',
|
||
method: 'post',
|
||
data: {
|
||
workerId: this.workerId,
|
||
},
|
||
success: res => {
|
||
if (res.code == 200) {
|
||
this.originWorkerInfo = {
|
||
...res.result.workerInfo
|
||
};
|
||
this.workerInfo = res.result.workerInfo;
|
||
console.info(res.result)
|
||
this.productRecord(res.result.workerInfo)
|
||
//获取证书附件
|
||
if (res.result.certificateList.length > 0) {
|
||
res.result.certificateList.forEach((item) => {
|
||
item.certificateState = false; //设置可编辑状态
|
||
if (item.photoUrl) {
|
||
let arr = item.photoUrl.split("*");
|
||
item.fileList = [{
|
||
name: arr[0],
|
||
url: arr[1]
|
||
}];
|
||
} else {
|
||
item.fileList = [];
|
||
}
|
||
});
|
||
};
|
||
this.certificateList = res.result.certificateList; //资格证书
|
||
this.workExperienceList = res.result.workExperienceList; //从业信息
|
||
//获取不良记录附件
|
||
if (res.result.badList.length > 0) {
|
||
res.result.badList.forEach((item) => {
|
||
if (item.fileUrl) {
|
||
item.fileList = JSON.parse(item.fileUrl); //设置可编辑状态
|
||
}
|
||
});
|
||
}
|
||
//获取奖励记录附件
|
||
if (res.result.rewardList.length > 0) {
|
||
res.result.rewardList.forEach((item) => {
|
||
if (item.fileUrl) {
|
||
item.fileList = JSON.parse(item.fileUrl); //设置可编辑状态
|
||
} else {
|
||
item.fileList = [];
|
||
}
|
||
});
|
||
}
|
||
|
||
this.badList = res.result.badList; // 不良记录
|
||
this.rewardList = res.result.rewardList; // 奖励记录
|
||
this.insuranceList = res.result.insuranceList; //保险
|
||
this.contractList = res.result.contractList; //合同
|
||
this.physicalsList = res.result.physicalsList; //体检列表
|
||
this.safeEducationList = res.result.safeEducationList; //安全教育
|
||
// 修改工号和身份证展示格式
|
||
if (this.workerInfo.idCard) {
|
||
let str = "***************"
|
||
this.workerInfo.idCard = this.workerInfo.idCard.substring(0, 3) + str + this
|
||
.workerInfo.idCard.substring(16)
|
||
}
|
||
if (this.workerInfo.attendanceNumber) {
|
||
let str = "***************"
|
||
this.workerInfo.attendanceNumber = this.workerInfo.attendanceNumber.substring(
|
||
0, 3) + str + this.workerInfo.attendanceNumber.substring(16)
|
||
}
|
||
if (this.workerInfo) {
|
||
this.setCodeColor(this.workerInfo.safeScore)
|
||
} else {
|
||
this.setCodeColor(0)
|
||
}
|
||
}
|
||
}
|
||
})
|
||
},
|
||
|
||
//显示操作 进退场按钮
|
||
operateBtn() {
|
||
this.operateType = !this.operateType;
|
||
},
|
||
//进场 退场操作
|
||
editPersonState() {
|
||
|
||
},
|
||
|
||
//显示列表
|
||
showInfoList(type) {
|
||
switch (type) {
|
||
case 1:
|
||
if (this.certificateList.length == 0) {
|
||
this.showCertificateList = false;
|
||
} else {
|
||
this.showCertificateList = !this.showCertificateList;
|
||
}
|
||
break;
|
||
case 2:
|
||
if (this.workExperienceList.length == 0) {
|
||
this.showWorkExperienceList = false;
|
||
} else {
|
||
this.showWorkExperienceList = !this.showWorkExperienceList;
|
||
}
|
||
break;
|
||
case 3:
|
||
if (this.rewardList.length == 0) {
|
||
this.showRewardList = false;
|
||
} else {
|
||
this.showRewardList = !this.showRewardList;
|
||
}
|
||
break;
|
||
case 4:
|
||
if (this.badList.length == 0) {
|
||
this.showBadList = false;
|
||
} else {
|
||
this.showBadList = !this.showBadList;
|
||
}
|
||
|
||
break;
|
||
case 5:
|
||
if (this.reduceScoreList.length == 0) {
|
||
this.showReduceScoreList = false;
|
||
} else {
|
||
this.showReduceScoreList = !this.showReduceScoreList;
|
||
}
|
||
|
||
break;
|
||
case 6:
|
||
uni.navigateTo({
|
||
url: "./addAttendanceManage?item=" + encodeURIComponent(JSON.stringify(this
|
||
.originWorkerInfo))
|
||
});
|
||
break;
|
||
}
|
||
},
|
||
//预览图片
|
||
previewImage(url, type) {
|
||
let fileList = [];
|
||
if (type == 1 || type == 2) {
|
||
fileList = [this.url_config + 'image/' + url]
|
||
}
|
||
uni.previewImage({
|
||
current: 0,
|
||
urls: fileList
|
||
})
|
||
},
|
||
editWokerInfo(image) {
|
||
this.sendRequest({
|
||
url: 'xmgl/workerInfo/edit',
|
||
method: 'put',
|
||
data: {
|
||
...this.originWorkerInfo,
|
||
fieldAcquisitionUrl: image
|
||
},
|
||
success: res => {
|
||
if (res.code == 200) {
|
||
uni.showToast({
|
||
title: '上传成功',
|
||
icon: 'none'
|
||
})
|
||
this.getDetailsData()
|
||
}
|
||
}
|
||
})
|
||
},
|
||
uploadImage() {
|
||
var that = this
|
||
uni.chooseImage({
|
||
count: 1,
|
||
success(res) {
|
||
const tempFilePaths = res.tempFilePaths[0];
|
||
that.compress(tempFilePaths).then(image => {
|
||
uni.uploadFile({
|
||
url: that.url_config + 'upload/image',
|
||
filePath: image,
|
||
name: 'files',
|
||
success: (uploadFileRes) => {
|
||
const imageUrl = JSON.parse(uploadFileRes.data).data[0]
|
||
.imageUrl
|
||
that.editWokerInfo(imageUrl)
|
||
},
|
||
fail(e) {
|
||
console.log(e)
|
||
}
|
||
});
|
||
}).catch(err => {
|
||
console.info(err, 'err')
|
||
})
|
||
}
|
||
})
|
||
},
|
||
//压缩图片
|
||
compress(img) {
|
||
console.log('开始压缩');
|
||
let that = this
|
||
return new Promise((resolve, reject) => {
|
||
// var localPath = plus.io.convertAbsoluteFileSystem(img);
|
||
plus.io.resolveLocalFileSystemURL(img, (entry) => { //通过URL参数获取目录对象或文件对象
|
||
entry.file((file) => { // 可通过entry对象操作图片
|
||
console.log('压缩前图片信息:' + JSON.stringify(file)); //压缩前图片信息
|
||
|
||
const size = Number(file.size) / 1000
|
||
console.info(size, 'size')
|
||
const quality = that.qualityNum(size)
|
||
|
||
if (size > 200) { // 如果大于200Kb进行压缩
|
||
plus.zip.compressImage({ // 5+ plus.zip.compressImage 了解一下,有详细的示例
|
||
src: img, //src: 压缩原始图片的路径
|
||
dst: img.replace('.png', '-rar.png').replace('.PNG',
|
||
'-rar.PNG').replace('.jpg', '-rar.jpg')
|
||
.replace('.JPG', '-rar.JPG'),
|
||
width: '40%', //dst: (String 类型 )压缩转换目标图片的路径,这里先在后面原始名后面加一个-rar区分一下
|
||
height: '40%', //width,height: (String 类型 )缩放图片的宽度,高度
|
||
quality: quality, //quality: (Number 类型 )压缩图片的质量
|
||
overwrite: true, //overwrite: (Boolean 类型 )覆盖生成新文件
|
||
// format:'jpg' //format: (String 类型 )压缩转换后的图片格式
|
||
}, (event) => {
|
||
const afterSize = Number(event.size) / 1000;
|
||
console.info(afterSize, 'afterSize')
|
||
console.log('压缩后图片信息:' + JSON.stringify(
|
||
event)); // 压缩后图片信息
|
||
let newImg = event.target;
|
||
// 压缩后还大于200,继续压缩
|
||
if (afterSize > 200) {
|
||
this.compress(newImg).then(response =>
|
||
resolve(response)
|
||
).catch(err => {
|
||
reject(err)
|
||
})
|
||
return;
|
||
}
|
||
resolve(newImg); //返回新的图片地址,在uploadFile之前接收
|
||
}, function(err) {
|
||
// console.log('Resolve file URL failed: ' + err.message);
|
||
});
|
||
} else { //else小于500kb跳过压缩,直接返回现有的src
|
||
resolve(img);
|
||
}
|
||
});
|
||
}, (e) => { // 返回错误信息
|
||
// console.log('Resolve file URL failed: ' + e.message);
|
||
reject(e)
|
||
});
|
||
})
|
||
},
|
||
qualityNum(size) {
|
||
let quality = 1
|
||
if (size < 200) {
|
||
return quality
|
||
}
|
||
if (size > 200 && size <= 512) {
|
||
quality = 0.9
|
||
} else if (size > 512 && size <= 1024) {
|
||
quality = 0.8
|
||
} else if (size > 1024 && size <= 2048) {
|
||
quality = 0.75
|
||
} else if (size > 2048 && size <= 10240) {
|
||
quality = 0.7
|
||
} else if (size > 10240 && size <= 20480) {
|
||
quality = 0.65
|
||
}
|
||
return quality
|
||
},
|
||
//查看信息详情
|
||
showItemDetails(type) {
|
||
// type == 1.合同; 2.体检; 3.保险; 4安全教育; 5.二维码 ; 6.补卡
|
||
let moduleInfo = null;
|
||
if (type == 1) {
|
||
moduleInfo = this.contractList;
|
||
} else if (type == 2) {
|
||
moduleInfo = this.physicalsList;
|
||
} else if (type == 3) {
|
||
moduleInfo = this.insuranceList;
|
||
} else if (type == 4) {
|
||
// moduleInfo = this.safeEducationList;
|
||
moduleInfo = [];
|
||
} else if (type == 5) {
|
||
// moduleInfo = this.safeEducationList;
|
||
} else if (type == 6) {
|
||
uni.navigateTo({
|
||
url: "./addAttendance?item=" + encodeURIComponent(JSON.stringify(this.originWorkerInfo))
|
||
});
|
||
return;
|
||
};
|
||
uni.setStorageSync('moduleInfo', moduleInfo)
|
||
uni.navigateTo({
|
||
url: "./detailsMod?type=" + type + "&workerId=" + this.workerId
|
||
})
|
||
},
|
||
|
||
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.kqbtn {
|
||
width: 100%;
|
||
height: 88rpx;
|
||
background-color: #2A8BF2;
|
||
color: white;
|
||
font-size: 32rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
position: fixed;
|
||
bottom: 0;
|
||
}
|
||
|
||
.flex {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.flex2 {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.flex3 {
|
||
display: flex;
|
||
}
|
||
|
||
.personDetail_content {
|
||
padding: 15px 30rpx 100rpx;
|
||
box-sizing: border-box;
|
||
width: 100%;
|
||
}
|
||
|
||
.personDetail_content .title_wrap {
|
||
width: 100%;
|
||
box-shadow: 0 4px 13px 0 rgba(212, 220, 236, 0.67);
|
||
box-sizing: border-box;
|
||
padding: 20px 28rpx 10px;
|
||
border-radius: 8px;
|
||
position: relative;
|
||
}
|
||
|
||
.title_wrap {
|
||
.exit_status {
|
||
position: absolute;
|
||
top: 15rpx;
|
||
right: 20rpx;
|
||
z-index: 10;
|
||
padding: 8rpx 24rpx;
|
||
font-size: 22rpx;
|
||
background: red;
|
||
color: #fff;
|
||
line-height: 14px;
|
||
border-radius: 3px;
|
||
}
|
||
}
|
||
|
||
.header_bg {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
z-index: 1;
|
||
width: 568rpx;
|
||
height: 90rpx;
|
||
}
|
||
|
||
.photograph {
|
||
width: 116rpx;
|
||
height: 150rpx;
|
||
z-index: 111;
|
||
margin-right: 8px;
|
||
}
|
||
|
||
.more {
|
||
width: 47rpx;
|
||
height: 37rpx;
|
||
z-index: 2222;
|
||
}
|
||
|
||
.more:active {
|
||
background-color: #999;
|
||
}
|
||
|
||
.user_info {
|
||
margin-left: 2px;
|
||
width: 50%;
|
||
}
|
||
|
||
.user_info .name {
|
||
font-size: 34rpx;
|
||
line-height: 48rpx;
|
||
font-weight: 500;
|
||
color: #488DEC;
|
||
|
||
}
|
||
|
||
.user_info .code {
|
||
font-size: 26rpx;
|
||
font-family: PingFangSC-Regular, PingFang SC;
|
||
font-weight: 400;
|
||
color: #2A2B5B;
|
||
line-height: 37rpx;
|
||
margin: 5px 0;
|
||
opacity: 0.8;
|
||
}
|
||
|
||
.user_info .nation {
|
||
font-size: 26rpx;
|
||
font-family: PingFangSC-Regular, PingFang SC;
|
||
font-weight: 400;
|
||
color: #2A2B5B;
|
||
line-height: 37rpx;
|
||
opacity: 0.8;
|
||
margin-bottom: 4px;
|
||
}
|
||
|
||
.projectName {
|
||
font-size: 30rpx;
|
||
font-family: PingFangSC-Medium, PingFang SC;
|
||
font-weight: 700;
|
||
color: #2A2B5B;
|
||
line-height: 42rpx;
|
||
margin-top: 15px;
|
||
}
|
||
|
||
.details-content {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
|
||
.left-content {
|
||
flex: 1;
|
||
}
|
||
}
|
||
|
||
.project_info {
|
||
font-size: 26rpx;
|
||
font-family: PingFangSC-Regular, PingFang SC;
|
||
font-weight: 400;
|
||
color: #2A2B5B;
|
||
line-height: 26px;
|
||
}
|
||
|
||
.project_info .name {
|
||
color: #372D66;
|
||
opacity: 0.6;
|
||
}
|
||
|
||
.item_wrap {
|
||
width: 100%;
|
||
margin: 10px 0;
|
||
box-shadow: 0 4px 13px 0 rgba(212, 220, 236, 0.67);
|
||
padding: 10px 0 10px 28rpx;
|
||
box-sizing: border-box;
|
||
border-radius: 8px;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.item_wrap .item {
|
||
width: 33%;
|
||
font-size: 30rpx;
|
||
font-family: PingFangSC-Regular, PingFang SC;
|
||
font-weight: 400;
|
||
color: #372D66;
|
||
line-height: 84rpx;
|
||
position: relative;
|
||
}
|
||
|
||
.item_wrap .item .state1 {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 58px;
|
||
padding: 3px 6px;
|
||
font-size: 20rpx;
|
||
background: #4181FE;
|
||
color: #fff;
|
||
line-height: 14px;
|
||
border-radius: 3px;
|
||
}
|
||
|
||
.item_wrap .item .state2 {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 58px;
|
||
padding: 3px 6px;
|
||
font-size: 20rpx;
|
||
background: red;
|
||
color: #fff;
|
||
line-height: 14px;
|
||
border-radius: 3px;
|
||
}
|
||
|
||
|
||
|
||
.margin_r_5 {
|
||
margin-right: 5px;
|
||
}
|
||
|
||
.log_wrap {
|
||
width: 100%;
|
||
margin: 10px 0;
|
||
box-shadow: 0 4px 13px 0 rgba(212, 220, 236, 0.67);
|
||
padding: 12px 28rpx;
|
||
box-sizing: border-box;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.log_wrap .title {
|
||
font-size: 30rpx;
|
||
font-family: PingFangSC-Medium, PingFang SC;
|
||
font-weight: 700;
|
||
color: #2A2B5B;
|
||
line-height: 42rpx;
|
||
}
|
||
|
||
.log_wrap .log_content {
|
||
margin-top: 8px;
|
||
border-top: 1px solid #C8C7CC;
|
||
box-sizing: border-box;
|
||
padding-top: 8px;
|
||
}
|
||
|
||
.log_wrap .log_content_item {
|
||
background-color: #f1f7fe;
|
||
border-radius: 2px;
|
||
border: 1px dashed #888888;
|
||
font-size: 26rpx;
|
||
font-family: PingFangSC-Regular, PingFang SC;
|
||
font-weight: 400;
|
||
color: #2A2B5B;
|
||
line-height: 40rpx;
|
||
box-sizing: border-box;
|
||
padding: 10px 28rpx;
|
||
margin-bottom: 8px;
|
||
}
|
||
|
||
.title_dialog {
|
||
position: absolute;
|
||
top: 20px;
|
||
right: 46px;
|
||
font-size: 12px;
|
||
line-height: 24px;
|
||
background-color: #fff;
|
||
width: 65px;
|
||
text-align: center;
|
||
z-index: 999;
|
||
border: 1px solid #999;
|
||
padding: 3px 8px;
|
||
border-radius: 2px;
|
||
}
|
||
</style> |