1964 lines
54 KiB
Vue
1964 lines
54 KiB
Vue
<template>
|
||
<view class="addIssue">
|
||
<view class="fixedheader">
|
||
<headers :showBack="true">
|
||
<view class="headerName"> 创建个人日志 </view>
|
||
</headers>
|
||
</view>
|
||
<view class="content" :style="{ paddingTop: mobileTopHeight + 44 + 'px' }">
|
||
<view class="content_main">
|
||
<view class="header-title">基础信息</view>
|
||
<view class="main-box">
|
||
<view class="box1">
|
||
<view>日期:</view>
|
||
<view>
|
||
{{ workTicketInfo.date }}
|
||
</view>
|
||
</view>
|
||
<view class="box1">
|
||
<view>风力:</view>
|
||
<view>
|
||
<template v-if="dateTimeUp(workTicketInfo.date) && dealTypeShow">
|
||
{{ workTicketInfo.weatherJson.win_speed }}
|
||
</template>
|
||
<view v-else @click="winSpeedShow = true">
|
||
<u-input disabled style="pointer-events:none"
|
||
:value="workTicketInfo.weatherJson.win_speed" type="text" :border="true"
|
||
placeholder="请选择" />
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="box1">
|
||
<view>气温:</view>
|
||
<view>
|
||
<template v-if="dateTimeUp(workTicketInfo.date) && dealTypeShow">
|
||
{{ workTicketInfo.weatherJson.tem_day }}
|
||
</template>
|
||
<u-input @blur="handleInput()" v-else v-model="workTicketInfo.weatherJson.tem_day"
|
||
type="number" :border="true" placeholder="请输入" />
|
||
</view>
|
||
</view>
|
||
<view class="box1">
|
||
<view>天气:</view>
|
||
<view>
|
||
<template v-if="dateTimeUp(workTicketInfo.date) && dealTypeShow">
|
||
{{ workTicketInfo.weatherJson.wea }}
|
||
</template>
|
||
<u-input v-else v-model="workTicketInfo.weatherJson.wea" type="text" :border="true"
|
||
placeholder="请输入" />
|
||
</view>
|
||
</view>
|
||
<view class="box1">
|
||
<view><text>*</text>施工区域:</view>
|
||
<view @click="onClickType(1)">
|
||
<u-input disabled style="pointer-events:none" :value="workTicketInfo.constructionAreaNames"
|
||
type="text" :border="true" placeholder="请选择" />
|
||
</view>
|
||
</view>
|
||
<view class="box1">
|
||
<view>施工单位:</view>
|
||
<view @click="onClickType(2)">
|
||
<u-input disabled style="pointer-events:none" :value="workTicketInfo.constructionUnitNames"
|
||
type="text" :border="true" placeholder="请选择" />
|
||
</view>
|
||
</view>
|
||
<view class="box1">
|
||
<view>施工人员:</view>
|
||
<view @click="onClickType(3)">
|
||
<u-input c :value="workTicketInfo.constructionWorkerNames" type="text" :border="true"
|
||
placeholder="请选择" />
|
||
</view>
|
||
</view>
|
||
<view class="box1">
|
||
<view>监理单位:</view>
|
||
<view @click="onClickType(4)">
|
||
<u-input disabled style="pointer-events:none" :value="workTicketInfo.supervisionUnitNames"
|
||
type="text" :border="true" placeholder="请选择" />
|
||
</view>
|
||
</view>
|
||
<view class="box1">
|
||
<view>监理人员:</view>
|
||
<view @click="onClickType(5)">
|
||
<u-input disabled style="pointer-events:none"
|
||
:value="workTicketInfo.supervisionPersonnelNames" type="text" :border="true"
|
||
placeholder="请选择" />
|
||
</view>
|
||
</view>
|
||
<view class="box1">
|
||
<view>施工任务:</view>
|
||
<view class="textarea">
|
||
<u-input :clearable="false" v-model="workTicketInfo.constructionTask" :maxlength="1000"
|
||
placeholder="请输入" type="textarea" :border="true" />
|
||
<view class="textarea_text"><text>{{ workTicketInfo.constructionTask.length }}</text>/1000
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="box1">
|
||
<view>施工机械:</view>
|
||
<view class="textarea">
|
||
<u-input :clearable="false" v-model="workTicketInfo.constructionMachinery" :maxlength="1000"
|
||
placeholder="请输入" type="textarea" :border="true" />
|
||
<view class="textarea_text">
|
||
<text>{{ workTicketInfo.constructionMachinery.length }}</text>/1000
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="box1">
|
||
<view>出勤情况:</view>
|
||
<view class="textarea">
|
||
<u-input :clearable="false" v-model="workTicketInfo.attendance" :maxlength="1000"
|
||
placeholder="请输入" type="textarea" :border="true" />
|
||
<view class="textarea_text"><text>{{ workTicketInfo.attendance.length }}</text>/1000
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="box2" @click="onPhotoRecognition">
|
||
<image src="/static/builder-camera.png"></image>
|
||
开始拍照识别
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="content_main1">
|
||
<view class="main3_box">
|
||
<view class="box-header">
|
||
<view>设计变更材料</view>
|
||
<view @click="uploadImg(1)">上传附件</view>
|
||
</view>
|
||
<view class="box-item" v-for="item in designChangeMaterial" :key="item.url">
|
||
<view class="box-item_left">
|
||
{{ item.name }}
|
||
</view>
|
||
<view class="box-item_right">
|
||
<!-- <view>{{item.fileSizeMb}}kb</view> -->
|
||
<view @click="handlePreview(item.url)">
|
||
<u-icon name="eye" color="#5382F6" size="32"></u-icon>
|
||
</view>
|
||
<view @click="deleteImg(item, 1)">
|
||
<image src="/static/icon-delete.png" class="icon-delete"></image>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="main3_box">
|
||
<view class="box-header">
|
||
<view>安全交底材料</view>
|
||
<view @click="uploadImg(2)">上传附件</view>
|
||
</view>
|
||
<view class="box-item" v-for="item in safetyBriefingMaterial" :key="item.url">
|
||
<view class="box-item_left">
|
||
{{ item.name }}
|
||
</view>
|
||
<view class="box-item_right">
|
||
<!-- <view>{{item.fileSizeMb}}kb</view> -->
|
||
<view @click="handlePreview(item.url)">
|
||
<u-icon name="eye" color="#5382F6" size="32"></u-icon>
|
||
</view>
|
||
<view @click="deleteImg(item, 2)">
|
||
<image src="/static/icon-delete.png" class="icon-delete"></image>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="main3_box">
|
||
<view class="box-header">
|
||
<view>技术交底材料</view>
|
||
<view @click="uploadImg(3)">上传附件</view>
|
||
</view>
|
||
<view class="box-item" v-for="item in technicalBriefingMaterial" :key="item.url">
|
||
<view class="box-item_left">
|
||
{{ item.name }}
|
||
</view>
|
||
<view class="box-item_right">
|
||
<!-- <view>{{item.fileSizeMb}}kb</view> -->
|
||
<view @click="handlePreview(item.url)">
|
||
<u-icon name="eye" color="#5382F6" size="32"></u-icon>
|
||
</view>
|
||
<view @click="deleteImg(item, 3)">
|
||
<image src="/static/icon-delete.png" class="icon-delete"></image>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="confrim-btn">
|
||
<view @click="onNavigateBack">取消</view>
|
||
<view @click="onSubmit">确定</view>
|
||
</view>
|
||
</view>
|
||
<u-popup :mask-close-able="false" v-model="constructionAreasShow" :closeable="false" mode="bottom">
|
||
<view class="content-popup">
|
||
<view class="content-popup_header"> 施工区域 </view>
|
||
<scroll-view v-if="qualityRegionList.length > 0" scroll-y="true">
|
||
<TreeView @node-click="onConstructionAreasClick" :multiple="true"
|
||
checked-bg-color="rgba(81,129,246,0.1)" :data="qualityRegionList" :children-key="'children'"
|
||
:label-key="'regionName'" :id-key="'id'" :value="constructionAreasList" />
|
||
</scroll-view>
|
||
<view class="new-nodata_height" v-else>
|
||
<view class="new-nodata">
|
||
<view></view>
|
||
<text>暂无数据...</text>
|
||
</view>
|
||
</view>
|
||
<view class="confrim-btn">
|
||
<view @click="onCancelClick(1)">取消</view>
|
||
<view @click="onSubmitType(1)">确定</view>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
<u-popup :mask-close-able="false" v-model="applicantsShow" :closeable="false" mode="bottom">
|
||
<view class="content-popup">
|
||
<view class="content-popup_header"> 施工单位 </view>
|
||
<scroll-view v-if="enterpriseInfoList.length > 0" scroll-y="true" >
|
||
<TreeView @node-click="onApplicantsClick" :multiple="true" checked-bg-color="rgba(81,129,246,0.1)"
|
||
:data="enterpriseInfoList" :children-key="'children'" :label-key="'enterpriseName'"
|
||
:id-key="'id'" :value="applicantsList" />
|
||
</scroll-view>
|
||
<view class="new-nodata_height" v-else>
|
||
<view class="new-nodata">
|
||
<view></view>
|
||
<text>暂无数据...</text>
|
||
</view>
|
||
</view>
|
||
<view class="confrim-btn">
|
||
<view @click="onCancelClick(2)">取消</view>
|
||
<view @click="onSubmitType(2)">确定</view>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
<u-popup :mask-close-able="false" v-model="operatorShow" :closeable="false" mode="bottom">
|
||
<view class="content-popup">
|
||
<view class="content-popup_header"> 施工人员 </view>
|
||
<scroll-view v-if="selectWorkerInfoList.length > 0" scroll-y="true" >
|
||
<TreeView @node-click="onOperatorClick" :multiple="true" checked-bg-color="rgba(81,129,246,0.1)"
|
||
:data="selectWorkerInfoList" :children-key="'children'" :label-key="'workerName'" :id-key="'id'"
|
||
:value="operatorsList" />
|
||
</scroll-view>
|
||
<view class="new-nodata_height" v-else>
|
||
<view class="new-nodata">
|
||
<view></view>
|
||
<text>暂无数据...</text>
|
||
</view>
|
||
</view>
|
||
<view class="confrim-btn">
|
||
<view @click="onCancelClick(3)">取消</view>
|
||
<view @click="onSubmitType(3)">确定</view>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
<u-popup :mask-close-able="false" v-model="supervisionShow" :closeable="false" mode="bottom">
|
||
<view class="content-popup">
|
||
<view class="content-popup_header"> 监理单位 </view>
|
||
<scroll-view v-if="cooperatorList.length > 0" scroll-y="true" >
|
||
<TreeView @node-click="onSupervisionClick" :multiple="true" checked-bg-color="rgba(81,129,246,0.1)"
|
||
:data="cooperatorList" :children-key="'children'" :label-key="'enterpriseName'" :id-key="'id'"
|
||
:value="supervisionList" />
|
||
</scroll-view>
|
||
<view class="new-nodata_height" v-else>
|
||
<view class="new-nodata">
|
||
<view></view>
|
||
<text>暂无数据...</text>
|
||
</view>
|
||
</view>
|
||
<view class="confrim-btn">
|
||
<view @click="onCancelClick(4)">取消</view>
|
||
<view @click="onSubmitType(4)">确定</view>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
<u-popup :mask-close-able="false" v-model="supervisorShow" :closeable="false" mode="bottom">
|
||
<view class="content-popup">
|
||
<view class="content-popup_header"> 监理人员 </view>
|
||
<scroll-view v-if="supervisionPersonnelList.length > 0" scroll-y="true" >
|
||
<TreeView @node-click="onSupervisorClick" :multiple="true" checked-bg-color="rgba(81,129,246,0.1)"
|
||
:data="supervisionPersonnelList" :children-key="'children'" :label-key="'workerName'"
|
||
:id-key="'id'" :value="supervisorList" />
|
||
</scroll-view>
|
||
<view class="new-nodata_height" v-else>
|
||
<view class="new-nodata">
|
||
<view></view>
|
||
<text>暂无数据...</text>
|
||
</view>
|
||
</view>
|
||
<view class="confrim-btn">
|
||
<view @click="onCancelClick(5)">取消</view>
|
||
<view @click="onSubmitType(5)">确定</view>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
<u-select :default-value="defaultIndex" :list="winSpeedList" v-model="winSpeedShow"
|
||
@confirm="actionSheetCallback"></u-select>
|
||
<u-toast ref="uToast" />
|
||
<canvas canvas-id="tempCanvas"
|
||
:style="`width:${canvasWidth}px;height:${canvasHeight}px;position: absolute; z-index: -999; top: 0;`"></canvas>
|
||
<!-- #ifndef APP-PLUS -->
|
||
<camera ref="camera" device-position="back" style="width: 100%; height: 300px;">
|
||
<cover-view class="controls" style="width: 100%;height: 100%;">
|
||
<cover-view class="controls1-bgcolor"></cover-view>
|
||
<cover-view class="app-guide-box" :style="guideBoxStyle"></cover-view>
|
||
<cover-view class="controls3-bgcolor"></cover-view>
|
||
</cover-view>
|
||
</camera>
|
||
<!-- <E-Run-custom-camera @confirm="confirm"></E-Run-custom-camera> -->
|
||
<!-- #endif -->
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import TreeView from "@/components/tree-view/TreeView.vue";
|
||
import {
|
||
handleAuthScan
|
||
} from "@/common/permissionTips";
|
||
import {
|
||
isJSON
|
||
} from "@/utils/tool.js";
|
||
export default {
|
||
components: {
|
||
TreeView,
|
||
},
|
||
data() {
|
||
return {
|
||
mobileTopHeight: 0,
|
||
projectDetail: {},
|
||
workTicketInfo: {
|
||
date: "",
|
||
constructionUnitIds: [],
|
||
constructionUnitNames: "",
|
||
constructionAreaIds: [],
|
||
constructionAreaNames: "",
|
||
constructionWorkerNames: "",
|
||
constructionWorkerIds: [],
|
||
supervisionUnitNames: "",
|
||
supervisionUnitIds: [],
|
||
supervisionPersonnelNames: "",
|
||
supervisionPersonnelIds: [],
|
||
constructionTask: "",
|
||
constructionMachinery: "",
|
||
attendance: "",
|
||
weatherJson: {
|
||
tem_day: "",
|
||
},
|
||
},
|
||
dealTypeShow: true,
|
||
// 区域
|
||
qualityRegionList: [],
|
||
constructionAreasList: [],
|
||
constructionAreasNameList: [],
|
||
constructionAreasShow: false,
|
||
// 施工单位
|
||
enterpriseInfoList: [],
|
||
applicantsList: [],
|
||
applicantsNameList: [],
|
||
applicantsShow: false,
|
||
// 施工人员
|
||
selectWorkerInfoList: [],
|
||
operatorShow: false,
|
||
operatorsList: [],
|
||
operatorsNameList: [],
|
||
// 监理单位
|
||
cooperatorList: [],
|
||
supervisionShow: false,
|
||
supervisionList: [],
|
||
supervisionNameList: [],
|
||
// 监理人员
|
||
supervisionPersonnelList: [],
|
||
supervisorShow: false,
|
||
supervisorList: [],
|
||
supervisorNameList: [],
|
||
// 上传附件
|
||
safetyBriefingMaterial: [],
|
||
designChangeMaterial: [],
|
||
technicalBriefingMaterial: [],
|
||
|
||
workTicketId: "",
|
||
onEditType: "",
|
||
policeCameraItemInfo: {},
|
||
userInfo: {},
|
||
defaultIndex: [0],
|
||
winSpeedShow: false,
|
||
winSpeedList: [],
|
||
ocrZonePlaceList: [],
|
||
screenWidth: 0,
|
||
screenHeight: 0,
|
||
pixelRatio: 0,
|
||
canvasWidth: 0,
|
||
canvasHeight: 0,
|
||
isApp: false,
|
||
cameraContext: null, // 新增相机上下文
|
||
showGuideBox: false, // 控制辅助框显示
|
||
guideBoxStyle: {}, // 辅助框样式
|
||
guideView: null, // 存储原生视图对象
|
||
};
|
||
},
|
||
onLoad(opts) {
|
||
this.projectDetail = JSON.parse(uni.getStorageSync("projectDetail"));
|
||
this.userInfo = JSON.parse(uni.getStorageSync("userInfo"));
|
||
console.log(1111, opts, this.projectDetail);
|
||
this.workTicketInfo.date = opts.date;
|
||
if (opts.id) {
|
||
this.workTicketId = opts.id;
|
||
this.getWorkTicketQueryByIdFn();
|
||
} else {
|
||
this.getWeather();
|
||
}
|
||
for (var i = 1; i <= 12; i++) {
|
||
this.winSpeedList.push({
|
||
label: `${i}级`,
|
||
value: `${i}级`,
|
||
});
|
||
}
|
||
this.getProjectEnterpriseListFn();
|
||
this.getQualityRegionListFn();
|
||
this.getOcrZonePlaceListFn();
|
||
},
|
||
mounted() {
|
||
var that = this;
|
||
uni.getSystemInfo({
|
||
success(res) {
|
||
that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
|
||
uni.setStorageSync("systemInfo", res);
|
||
// 保存手机宽高
|
||
that.screenWidth = res.screenWidth;
|
||
that.screenHeight = res.screenHeight;
|
||
console.log(res);
|
||
// 获取并存储设备像素比
|
||
that.pixelRatio = res.pixelRatio;
|
||
console.log("设备像素比:", that.pixelRatio);
|
||
|
||
// 判断是否为APP端
|
||
// #ifdef APP-PLUS
|
||
that.isApp = true;
|
||
// #endif
|
||
|
||
// #ifdef H5 || MP
|
||
that.isApp = false;
|
||
// #endif
|
||
},
|
||
});
|
||
},
|
||
onShow() {
|
||
// 在当前页面监听事件
|
||
uni.$on('updateData', (data) => {
|
||
// 处理接收到的数据
|
||
console.log("接收到参数", data)
|
||
this.takePhoto(data)
|
||
});
|
||
},
|
||
methods: {
|
||
// 列表查询ocr识别区域位置信息
|
||
getOcrZonePlaceListFn() {
|
||
let that = this;
|
||
let data = {
|
||
projectSn: this.projectDetail.projectSn,
|
||
};
|
||
this.sendRequest({
|
||
url: "xmgl/ocrModulePlace/list",
|
||
method: "GET",
|
||
data: data,
|
||
success: (res) => {
|
||
if (res.code == 200) {
|
||
that.ocrZonePlaceList = res.result;
|
||
}
|
||
},
|
||
});
|
||
},
|
||
handleInput() {
|
||
console.log(this.workTicketInfo.weatherJson.tem_day);
|
||
if (Number(this.workTicketInfo.weatherJson.tem_day) > 50) {
|
||
this.workTicketInfo.weatherJson.tem_day = 50;
|
||
} else if (Number(this.workTicketInfo.weatherJson.tem_day) < -50) {
|
||
this.workTicketInfo.weatherJson.tem_day = -50;
|
||
}
|
||
},
|
||
actionSheetCallback(event) {
|
||
const findIndex = this.winSpeedList.findIndex(
|
||
(item) => item.value == event[0].value
|
||
);
|
||
this.defaultIndex = [findIndex];
|
||
this.workTicketInfo.weatherJson.win_speed = event[0].value;
|
||
},
|
||
// 通过id查询工作票信息
|
||
getWorkTicketQueryByIdFn() {
|
||
let that = this;
|
||
let data = {
|
||
projectSn: this.projectDetail.projectSn,
|
||
id: this.workTicketId,
|
||
};
|
||
this.sendRequest({
|
||
url: "xmgl/ocrBuildLog/queryById",
|
||
method: "GET",
|
||
data: data,
|
||
success: (res) => {
|
||
if (res.code == 200) {
|
||
this.workTicketInfo = {
|
||
...res.result,
|
||
constructionAreaIds: res.result.constructionAreaIds ?
|
||
res.result.constructionAreaIds.split(",") : [],
|
||
constructionUnitIds: res.result.constructionUnitIds ?
|
||
res.result.constructionUnitIds.split(",") : [],
|
||
constructionWorkerIds: res.result.constructionWorkerIds ?
|
||
res.result.constructionWorkerIds.split(",") : [],
|
||
supervisionUnitIds: res.result.supervisionUnitIds ?
|
||
res.result.supervisionUnitIds.split(",") : [],
|
||
supervisionPersonnelIds: res.result.supervisionPersonnelIds ?
|
||
res.result.supervisionPersonnelIds.split(",") : [],
|
||
weatherJson: isJSON(res.result.weatherJson) ?
|
||
JSON.parse(res.result.weatherJson) : {},
|
||
};
|
||
this.technicalBriefingMaterial =
|
||
res.result.technicalBriefingMaterial &&
|
||
Array.isArray(JSON.parse(res.result.technicalBriefingMaterial)) ?
|
||
JSON.parse(res.result.technicalBriefingMaterial) : [];
|
||
this.safetyBriefingMaterial =
|
||
res.result.safetyBriefingMaterial &&
|
||
Array.isArray(JSON.parse(res.result.safetyBriefingMaterial)) ?
|
||
JSON.parse(res.result.safetyBriefingMaterial) : [];
|
||
this.designChangeMaterial =
|
||
res.result.designChangeMaterial &&
|
||
Array.isArray(JSON.parse(res.result.designChangeMaterial)) ?
|
||
JSON.parse(res.result.designChangeMaterial) : [];
|
||
this.getEnterpriseInfoListFn();
|
||
this.getSelectWorkerInfoListFn();
|
||
this.getSupervisionPersonnelListFn();
|
||
}
|
||
},
|
||
});
|
||
},
|
||
onSubmit() {
|
||
if (this.workTicketId) {
|
||
this.getworkTicketEditFn();
|
||
} else {
|
||
this.getworkTicketAddFn();
|
||
}
|
||
},
|
||
// 编辑工作票
|
||
getworkTicketEditFn() {
|
||
let that = this;
|
||
let data = {
|
||
...this.workTicketInfo,
|
||
constructionUnitIds: this.workTicketInfo.constructionUnitIds.join(","),
|
||
constructionAreaIds: this.workTicketInfo.constructionAreaIds.join(","),
|
||
constructionWorkerIds: this.workTicketInfo.constructionWorkerIds.join(","),
|
||
supervisionUnitIds: this.workTicketInfo.supervisionUnitIds.join(","),
|
||
supervisionPersonnelIds: this.workTicketInfo.supervisionPersonnelIds.join(","),
|
||
technicalBriefingMaterial: JSON.stringify(
|
||
this.technicalBriefingMaterial
|
||
),
|
||
safetyBriefingMaterial: JSON.stringify(this.safetyBriefingMaterial),
|
||
designChangeMaterial: JSON.stringify(this.designChangeMaterial),
|
||
weatherJson: JSON.stringify(this.workTicketInfo.weatherJson),
|
||
projectSn: this.projectDetail.projectSn,
|
||
type: 2,
|
||
};
|
||
console.log(data);
|
||
if (!data.constructionUnitIds) {
|
||
this.showToast("有必填项未填写!", "warning");
|
||
return;
|
||
}
|
||
this.sendRequest({
|
||
url: "xmgl/ocrBuildLog/edit",
|
||
method: "POST",
|
||
data: data,
|
||
success: (res) => {
|
||
if (res.code == 200) {
|
||
that.showToast("编辑成功", "success");
|
||
setTimeout(() => {
|
||
that.onNavigateBack();
|
||
}, 800);
|
||
}
|
||
},
|
||
});
|
||
},
|
||
// 添加个人日志
|
||
getworkTicketAddFn() {
|
||
let that = this;
|
||
let data = {
|
||
...this.workTicketInfo,
|
||
constructionUnitIds: this.workTicketInfo.constructionUnitIds.join(","),
|
||
constructionAreaIds: this.workTicketInfo.constructionAreaIds.join(","),
|
||
constructionWorkerIds: this.workTicketInfo.constructionWorkerIds.join(","),
|
||
supervisionUnitIds: this.workTicketInfo.supervisionUnitIds.join(","),
|
||
supervisionPersonnelIds: this.workTicketInfo.supervisionPersonnelIds.join(","),
|
||
technicalBriefingMaterial: JSON.stringify(
|
||
this.technicalBriefingMaterial
|
||
),
|
||
safetyBriefingMaterial: JSON.stringify(this.safetyBriefingMaterial),
|
||
designChangeMaterial: JSON.stringify(this.designChangeMaterial),
|
||
weatherJson: JSON.stringify(this.workTicketInfo.weatherJson),
|
||
projectSn: this.projectDetail.projectSn,
|
||
type: 2,
|
||
};
|
||
if (!data.constructionUnitIds) {
|
||
this.showToast("有必填项未填写!", "warning");
|
||
return;
|
||
}
|
||
this.sendRequest({
|
||
url: "xmgl/ocrBuildLog/add",
|
||
method: "POST",
|
||
data: data,
|
||
success: (res) => {
|
||
if (res.code == 200) {
|
||
that.showToast("添加成功", "success");
|
||
setTimeout(() => {
|
||
uni.$emit("updateData");
|
||
that.onNavigateBack();
|
||
}, 800);
|
||
}
|
||
},
|
||
});
|
||
},
|
||
// 取消
|
||
onNavigateBack() {
|
||
uni.navigateBack({
|
||
delta: 1,
|
||
});
|
||
},
|
||
// 多选下拉 1区域 2单位 3人员 4监理单位 5 监理人员
|
||
onClickType(type) {
|
||
if (type == 1) {
|
||
this.constructionAreasList =
|
||
this.workTicketInfo.constructionAreaIds.map((item) => item);
|
||
this.constructionAreasNameList = this.workTicketInfo
|
||
.constructionAreaNames ?
|
||
this.workTicketInfo.constructionAreaNames.split(",") : [];
|
||
this.constructionAreasShow = true;
|
||
} else if (type == 2) {
|
||
this.applicantsList = this.workTicketInfo.constructionUnitIds.map(
|
||
(item) => item
|
||
);
|
||
this.applicantsNameList = this.workTicketInfo.constructionUnitNames ?
|
||
this.workTicketInfo.constructionUnitNames.split(",") : [];
|
||
this.applicantsShow = true;
|
||
} else if (type == 3) {
|
||
this.operatorsList = this.workTicketInfo.constructionWorkerIds.map(
|
||
(item) => item
|
||
);
|
||
this.operatorsNameList = this.workTicketInfo.constructionWorkerNames ?
|
||
this.workTicketInfo.constructionWorkerNames.split(",") : [];
|
||
this.operatorShow = true;
|
||
} else if (type == 4) {
|
||
this.supervisionList = this.workTicketInfo.supervisionUnitIds.map(
|
||
(item) => item
|
||
);
|
||
this.supervisionNameList = this.workTicketInfo.supervisionUnitNames ?
|
||
this.workTicketInfo.supervisionUnitNames.split(",") : [];
|
||
this.supervisionShow = true;
|
||
} else if (type == 5) {
|
||
this.supervisorList = this.workTicketInfo.supervisionPersonnelIds.map(
|
||
(item) => item
|
||
);
|
||
this.supervisorNameList = this.workTicketInfo.supervisionPersonnelNames ?
|
||
this.workTicketInfo.supervisionPersonnelNames.split(",") : [];
|
||
this.supervisorShow = true;
|
||
}
|
||
},
|
||
// 区域
|
||
onConstructionAreasClick(id, checked, label) {
|
||
const idx = this.constructionAreasList.indexOf(id);
|
||
if (checked && idx === -1) {
|
||
this.constructionAreasList.push(id);
|
||
this.constructionAreasNameList.push(label);
|
||
} else if (!checked && idx !== -1) {
|
||
this.constructionAreasList.splice(idx, 1);
|
||
this.constructionAreasNameList.splice(idx, 1);
|
||
}
|
||
},
|
||
// 单位
|
||
onApplicantsClick(id, checked, label) {
|
||
const idx = this.applicantsList.indexOf(id);
|
||
if (checked && idx === -1) {
|
||
this.applicantsList.push(id);
|
||
this.applicantsNameList.push(label);
|
||
} else if (!checked && idx !== -1) {
|
||
this.applicantsList.splice(idx, 1);
|
||
this.applicantsNameList.splice(idx, 1);
|
||
}
|
||
},
|
||
// 人员
|
||
onOperatorClick(id, checked, label) {
|
||
const idx = this.operatorsList.indexOf(id);
|
||
if (checked && idx === -1) {
|
||
this.operatorsList.push(id);
|
||
this.operatorsNameList.push(label);
|
||
} else if (!checked && idx !== -1) {
|
||
this.operatorsList.splice(idx, 1);
|
||
this.operatorsNameList.splice(idx, 1);
|
||
}
|
||
},
|
||
// 监理单位
|
||
onSupervisionClick(id, checked, label) {
|
||
const idx = this.supervisionList.indexOf(id);
|
||
if (checked && idx === -1) {
|
||
this.supervisionList.push(id);
|
||
this.supervisionNameList.push(label);
|
||
} else if (!checked && idx !== -1) {
|
||
this.supervisionList.splice(idx, 1);
|
||
this.supervisionNameList.splice(idx, 1);
|
||
}
|
||
},
|
||
// 监理人员
|
||
onSupervisorClick(id, checked, label) {
|
||
const idx = this.supervisorList.indexOf(id);
|
||
if (checked && idx === -1) {
|
||
this.supervisorList.push(id);
|
||
this.supervisorNameList.push(label);
|
||
} else if (!checked && idx !== -1) {
|
||
this.supervisorList.splice(idx, 1);
|
||
this.supervisorNameList.splice(idx, 1);
|
||
}
|
||
},
|
||
onSubmitType(type) {
|
||
if (type == 1) {
|
||
console.log(11233, this.constructionAreasNameList);
|
||
this.workTicketInfo.constructionAreaIds = [
|
||
...this.constructionAreasList,
|
||
];
|
||
this.workTicketInfo.constructionAreaNames =
|
||
this.constructionAreasNameList.join(",");
|
||
this.constructionAreasShow = false;
|
||
this.getEnterpriseInfoListFn();
|
||
} else if (type == 2) {
|
||
this.workTicketInfo.constructionUnitIds = [...this.applicantsList];
|
||
this.workTicketInfo.constructionUnitNames =
|
||
this.applicantsNameList.join(",");
|
||
this.applicantsShow = false;
|
||
this.getSelectWorkerInfoListFn();
|
||
} else if (type == 3) {
|
||
this.workTicketInfo.constructionWorkerIds = [...this.operatorsList];
|
||
this.workTicketInfo.constructionWorkerNames =
|
||
this.operatorsNameList.join(",");
|
||
this.operatorShow = false;
|
||
} else if (type == 4) {
|
||
this.workTicketInfo.supervisionUnitIds = [...this.supervisionList];
|
||
this.workTicketInfo.supervisionUnitNames =
|
||
this.supervisionNameList.join(",");
|
||
this.supervisionShow = false;
|
||
this.getSupervisionPersonnelListFn();
|
||
} else if (type == 5) {
|
||
this.workTicketInfo.supervisionPersonnelIds = [...this.supervisorList];
|
||
this.workTicketInfo.supervisionPersonnelNames =
|
||
this.supervisorNameList.join(",");
|
||
this.supervisorShow = false;
|
||
}
|
||
},
|
||
onCancelClick(type) {
|
||
if (type == 1) {
|
||
this.constructionAreasList = [
|
||
...this.workTicketInfo.constructionAreaIds,
|
||
];
|
||
this.constructionAreasShow = false;
|
||
} else if (type == 2) {
|
||
this.applicantsList = [...this.workTicketInfo.constructionUnitIds];
|
||
this.applicantsShow = false;
|
||
} else if (type == 3) {
|
||
this.operatorsList = [...this.workTicketInfo.constructionWorkerIds];
|
||
this.operatorShow = false;
|
||
} else if (type == 4) {
|
||
this.supervisionList = [...this.workTicketInfo.supervisionUnitIds];
|
||
this.supervisionShow = false;
|
||
} else if (type == 5) {
|
||
this.supervisorList = [...this.workTicketInfo.supervisionPersonnelIds];
|
||
this.supervisorShow = false;
|
||
}
|
||
},
|
||
//上传附件
|
||
uploadImg(type) {
|
||
var that = this;
|
||
if (type == 1) {
|
||
this.$chooseImage({
|
||
// count: 5 - that.designChangeMaterial.length,
|
||
success(res) {
|
||
const tempFilePaths = res.tempFilePaths;
|
||
uni.uploadFile({
|
||
url: that.url_config + "upload/image", //仅为示例,非真实的接口地址
|
||
filePath: tempFilePaths[0],
|
||
name: "files",
|
||
success: (uploadFileRes) => {
|
||
let data = {
|
||
name: JSON.parse(uploadFileRes.data).data[0].filename,
|
||
url: that.url_config +
|
||
"image/" +
|
||
JSON.parse(uploadFileRes.data).data[0].imageUrl,
|
||
};
|
||
that.designChangeMaterial.push(data);
|
||
},
|
||
});
|
||
},
|
||
});
|
||
} else if (type == 2) {
|
||
this.$chooseImage({
|
||
// count: 5 - that.safetyBriefingMaterial.length,
|
||
success(res) {
|
||
const tempFilePaths = res.tempFilePaths;
|
||
uni.uploadFile({
|
||
url: that.url_config + "upload/image", //仅为示例,非真实的接口地址
|
||
filePath: tempFilePaths[0],
|
||
name: "files",
|
||
success: (uploadFileRes) => {
|
||
let data = {
|
||
name: JSON.parse(uploadFileRes.data).data[0].filename,
|
||
url: that.url_config +
|
||
"image/" +
|
||
JSON.parse(uploadFileRes.data).data[0].imageUrl,
|
||
};
|
||
that.safetyBriefingMaterial.push(data);
|
||
},
|
||
});
|
||
},
|
||
});
|
||
} else if (type == 3) {
|
||
this.$chooseImage({
|
||
// count: 5 - that.technicalBriefingMaterial.length,
|
||
success(res) {
|
||
const tempFilePaths = res.tempFilePaths;
|
||
uni.uploadFile({
|
||
url: that.url_config + "upload/image", //仅为示例,非真实的接口地址
|
||
filePath: tempFilePaths[0],
|
||
name: "files",
|
||
success: (uploadFileRes) => {
|
||
let data = {
|
||
name: JSON.parse(uploadFileRes.data).data[0].filename,
|
||
url: that.url_config +
|
||
"image/" +
|
||
JSON.parse(uploadFileRes.data).data[0].imageUrl,
|
||
};
|
||
that.technicalBriefingMaterial.push(data);
|
||
},
|
||
});
|
||
},
|
||
});
|
||
}
|
||
},
|
||
async batchCrop(image, resultList) {
|
||
let that = this;
|
||
const results = [];
|
||
|
||
try {
|
||
for (let i = 0; i < resultList.length; i++) {
|
||
if (resultList[i]) {
|
||
try {
|
||
const object = resultList[i];
|
||
|
||
console.log(`开始裁剪第${i + 1}个区域:`, object);
|
||
|
||
const croppedPath = await that.cropAndScaleImage(
|
||
image,
|
||
object.left,
|
||
object.top,
|
||
object.width,
|
||
object.height,
|
||
that.screenWidth,
|
||
);
|
||
|
||
// console.log(`第${i + 1}个区域裁剪完成:`, croppedPath);
|
||
|
||
results.push({
|
||
...resultList[i],
|
||
croppedPath,
|
||
});
|
||
|
||
// 串行执行,每次裁剪后稍作延迟
|
||
if (i < resultList.length - 1) {
|
||
await new Promise(resolve => setTimeout(resolve, 200));
|
||
}
|
||
} catch (error) {
|
||
console.error(`第${i + 1}个区域裁剪失败:`, error);
|
||
// 继续处理下一个,不中断整个流程
|
||
results.push({
|
||
...resultList[i],
|
||
croppedPath: null,
|
||
error: error.message
|
||
});
|
||
}
|
||
}
|
||
}
|
||
} catch (error) {
|
||
console.error('批量裁剪失败:', error);
|
||
throw error;
|
||
}
|
||
|
||
return results;
|
||
},
|
||
//添加照片水印
|
||
watermark(info) {
|
||
console.log("获取到的数据为", info)
|
||
},
|
||
async onPhotoRecognition() {
|
||
let that = this;
|
||
const resultList = this.ocrZonePlaceList.filter(item => ['ocr1'].includes(item
|
||
.placeCode));
|
||
|
||
if (resultList.length === 0) {
|
||
that.showToast('未找到OCR识别区域配置', 'warning');
|
||
return;
|
||
}
|
||
const configJson = JSON.parse(resultList[0].configJson);
|
||
const configJsonList = configJson.objects.filter(item => ['code1', 'code2', 'code3'].includes(item
|
||
.zoneCode)).map(item => {
|
||
return {
|
||
...item,
|
||
height: item.height * item.scaleY,
|
||
width: item.width * item.scaleX,
|
||
}
|
||
});
|
||
|
||
if (configJsonList.length == 0) {
|
||
that.showToast('未找到OCR识别区域配置', 'warning');
|
||
return;
|
||
}
|
||
console.log(33344, configJsonList)
|
||
// #ifdef APP-PLUS
|
||
uni.navigateTo({
|
||
url: `./components/watermarkCamera?resultList=${JSON.stringify(configJsonList)}` // 跳转到 nvue 页面并传递参数
|
||
});
|
||
return
|
||
// #endif
|
||
this.$chooseImage({
|
||
// count: 5 - that.technicalBriefingMaterial.length,
|
||
success(res) {
|
||
const tempFilePaths = res.tempFilePaths;
|
||
console.log(11223344, tempFilePaths)
|
||
that.takePhoto(tempFilePaths[0])
|
||
},
|
||
fail: (error) => {
|
||
console.error('选择图片失败:', error);
|
||
}
|
||
});
|
||
},
|
||
takePhoto(tempFilePaths) {
|
||
const resultList = this.ocrZonePlaceList.filter(item => ['ocr1'].includes(item
|
||
.placeCode));
|
||
const configJson = JSON.parse(resultList[0].configJson);
|
||
const configJsonList = configJson.objects.filter(item => ['code1', 'code2', 'code3'].includes(item
|
||
.zoneCode)).map(item => {
|
||
return {
|
||
...item,
|
||
height: item.height,
|
||
width: item.width,
|
||
}
|
||
});
|
||
console.log(4444, configJsonList, tempFilePaths)
|
||
let that = this;
|
||
// 显示上传中提示
|
||
uni.showLoading({
|
||
title: '上传图片中...'
|
||
});
|
||
uni.uploadFile({
|
||
url: that.url_config + 'upload/image', //仅为示例,非真实的接口地址
|
||
filePath: tempFilePaths,
|
||
name: 'files',
|
||
success: async (uploadFileRes) => {
|
||
try {
|
||
const url = that.url_config + 'image/' + JSON.parse(
|
||
uploadFileRes
|
||
.data).data[0].imageUrl
|
||
// that.url_config + "image/" + "688883d5e530b97ccd433b03.jpg"
|
||
console.log('图片上传成功:', url);
|
||
uni.showLoading({
|
||
title: '裁剪图片中...'
|
||
});
|
||
const dataList = await that.batchCrop(url, configJsonList);
|
||
uni.hideLoading();
|
||
console.log('批量裁剪完成:', dataList);
|
||
// 串行处理OCR识别
|
||
for (let i = 0; i < dataList.length; i++) {
|
||
const item = dataList[i];
|
||
if (item.croppedPath) {
|
||
await new Promise(resolve => {
|
||
setTimeout(async () => {
|
||
await that
|
||
.setOcrConfigPicOcrFn(
|
||
item);
|
||
resolve();
|
||
}, i * 300);
|
||
});
|
||
}
|
||
}
|
||
that.showToast('识别完成', 'success');
|
||
} catch (error) {
|
||
uni.hideLoading();
|
||
console.error('处理失败:', error);
|
||
that.showToast('处理失败: ' + error.message, 'error');
|
||
}
|
||
},
|
||
fail: (error) => {
|
||
uni.hideLoading();
|
||
console.error('上传失败:', error);
|
||
that.showToast('图片上传失败', 'error');
|
||
}
|
||
});
|
||
|
||
},
|
||
// 图片ocr
|
||
setOcrConfigPicOcrFn(item) {
|
||
return new Promise((resolve, reject) => {
|
||
let that = this;
|
||
let data = {
|
||
projectSn: this.projectDetail.projectSn,
|
||
base64Img: item.croppedPath,
|
||
};
|
||
console.log('开始OCR识别:', item.zoneCode, item.croppedPath);
|
||
this.sendRequest({
|
||
url: "xmgl/ocrConfig/picOcr",
|
||
method: "POST",
|
||
data: data,
|
||
success: (res) => {
|
||
if (res.code == 200) {
|
||
console.log('OCR识别结果:', item.zoneCode, res.result);
|
||
if (item.zoneCode == 'code1') {
|
||
that.workTicketInfo.constructionTask = res.result ? res.result :
|
||
'';
|
||
} else if (item.zoneCode == 'code2') {
|
||
that.workTicketInfo.constructionMachinery = res.result ? res
|
||
.result : '';
|
||
} else if (item.zoneCode == 'code3') {
|
||
that.workTicketInfo.attendance = res.result ? res.result : '';
|
||
}
|
||
resolve(res.result);
|
||
} else {
|
||
console.error('OCR识别失败:', res);
|
||
reject(new Error(res.message || 'OCR识别失败'));
|
||
}
|
||
},
|
||
fail: (error) => {
|
||
console.error('OCR请求失败:', error);
|
||
reject(error);
|
||
}
|
||
});
|
||
});
|
||
},
|
||
cropAndScaleImage(filePath, x = 0, y = 0, width, height, displayWidth) {
|
||
return new Promise((resolve, reject) => {
|
||
// 获取图片信息
|
||
uni.getImageInfo({
|
||
src: filePath,
|
||
success: (imgInfo) => {
|
||
const imgW = imgInfo.width;
|
||
const imgH = imgInfo.height;
|
||
|
||
// 1. 页面图片显示宽度
|
||
const pageW = displayWidth || uni.getSystemInfoSync().windowWidth;
|
||
|
||
// 2. 计算比例
|
||
const scale = imgW / pageW;
|
||
|
||
// 3. 映射到图片原始尺寸
|
||
const cropX = x * scale;
|
||
const cropY = y * scale;
|
||
const cropWidth = width * scale;
|
||
const cropHeight = height * scale;
|
||
|
||
// 4. 边界检查,确保裁剪区域不超出图片范围
|
||
const maxCropX = Math.max(0, Math.min(cropX, imgW - 1));
|
||
const maxCropY = Math.max(0, Math.min(cropY, imgH - 1));
|
||
const maxCropWidth = Math.min(cropWidth, imgW - maxCropX);
|
||
const maxCropHeight = Math.min(cropHeight, imgH - maxCropY);
|
||
|
||
// 5. 计算目标尺寸,限制最大高度避免空白
|
||
const pixelRatio = uni.getSystemInfoSync().pixelRatio;
|
||
let targetWidth = pageW;
|
||
// let targetHeight = (maxCropHeight / maxCropWidth) * targetWidth;
|
||
let targetHeight = maxCropHeight * targetWidth;
|
||
|
||
// 限制最大高度,避免画布过高导致空白
|
||
const maxHeight = pageW * 3; // 最大高度为宽度的3倍
|
||
if (targetHeight > maxHeight) {
|
||
targetHeight = maxHeight;
|
||
// 按比例调整宽度
|
||
targetWidth = (maxCropWidth / maxCropHeight) * targetHeight;
|
||
}
|
||
|
||
this.canvasWidth = targetWidth;
|
||
this.canvasHeight = targetHeight;
|
||
console.log('裁剪参数:', {
|
||
imgW,
|
||
imgH,
|
||
scale,
|
||
cropX: maxCropX,
|
||
cropY: maxCropY,
|
||
cropWidth: maxCropWidth,
|
||
cropHeight: maxCropHeight,
|
||
targetWidth,
|
||
targetHeight
|
||
});
|
||
console.log('边界检查:', {
|
||
originalCropX: cropX,
|
||
originalCropY: cropY,
|
||
originalCropWidth: cropWidth,
|
||
originalCropHeight: cropHeight,
|
||
maxCropX,
|
||
maxCropY,
|
||
maxCropWidth,
|
||
maxCropHeight
|
||
});
|
||
|
||
// 兼容手机端:确保画布已渲染完成
|
||
this.$nextTick(() => {
|
||
const ctx = uni.createCanvasContext('tempCanvas', this);
|
||
|
||
// 清空画布(兼容性处理)
|
||
ctx.clearRect(0, 0, targetWidth, targetHeight);
|
||
|
||
ctx.drawImage(
|
||
filePath,
|
||
maxCropX, maxCropY, maxCropWidth, maxCropHeight,
|
||
0, 0, targetWidth, targetHeight
|
||
);
|
||
|
||
// 兼容手机端:增加延迟确保绘制完成
|
||
ctx.draw(false, () => {
|
||
// APP端需要额外延迟
|
||
const delay = this.isApp ? 100 : 0;
|
||
setTimeout(() => {
|
||
uni.canvasToTempFilePath({
|
||
canvasId: 'tempCanvas',
|
||
width: targetWidth,
|
||
height: targetHeight,
|
||
destWidth: targetWidth,
|
||
destHeight: targetHeight,
|
||
success: (res) => {
|
||
// console.log(
|
||
// '裁剪成功:',
|
||
// res
|
||
// .tempFilePath
|
||
// );
|
||
|
||
// 根据平台处理返回结果
|
||
// #ifdef H5
|
||
// H5端直接返回路径
|
||
resolve(res
|
||
.tempFilePath
|
||
);
|
||
// #endif
|
||
|
||
// #ifdef APP-PLUS || MP
|
||
// APP端和小程序端尝试转换为base64
|
||
this.fileToBase64(
|
||
res
|
||
.tempFilePath
|
||
)
|
||
.then(
|
||
base64Data => {
|
||
resolve
|
||
(
|
||
base64Data
|
||
);
|
||
})
|
||
.catch(
|
||
error => {
|
||
console
|
||
.warn(
|
||
'base64转换失败,返回原路径:',
|
||
error
|
||
);
|
||
resolve
|
||
(res
|
||
.tempFilePath
|
||
);
|
||
});
|
||
// #endif
|
||
},
|
||
fail: (err) => {
|
||
console.error(
|
||
'裁剪失败:',
|
||
err);
|
||
reject(err);
|
||
}
|
||
}, this);
|
||
}, delay);
|
||
});
|
||
});
|
||
},
|
||
fail: (err) => {
|
||
console.error('获取图片信息失败:', err);
|
||
reject(err);
|
||
},
|
||
});
|
||
});
|
||
},
|
||
// 将文件转换为base64
|
||
fileToBase64(filePath) {
|
||
return new Promise((resolve, reject) => {
|
||
// #ifdef H5
|
||
// H5端不支持文件系统管理器,直接返回路径
|
||
console.log('H5端不支持文件转base64,返回原路径');
|
||
resolve(filePath);
|
||
// #endif
|
||
|
||
// #ifdef MP
|
||
// 小程序端使用文件系统管理器
|
||
try {
|
||
const fs = uni.getFileSystemManager();
|
||
console.log('小程序文件系统管理器:', fs);
|
||
|
||
// 检查文件系统管理器是否可用
|
||
if (!fs || typeof fs.readFile !== 'function') {
|
||
console.warn('文件系统管理器不可用,返回原路径');
|
||
resolve(filePath);
|
||
return;
|
||
}
|
||
|
||
fs.readFile({
|
||
filePath: filePath,
|
||
encoding: 'base64',
|
||
success: (res) => {
|
||
const base64Data = 'data:image/jpeg;base64,' + res.data;
|
||
console.log('小程序文件转base64成功');
|
||
resolve(base64Data);
|
||
},
|
||
fail: (err) => {
|
||
console.error('小程序文件转base64失败:', err);
|
||
// 失败时返回原路径
|
||
resolve(filePath);
|
||
}
|
||
});
|
||
} catch (error) {
|
||
console.error('小程序文件系统管理器获取失败:', error);
|
||
// 异常时返回原路径
|
||
resolve(filePath);
|
||
}
|
||
// #endif
|
||
|
||
// #ifdef APP-PLUS
|
||
// APP端使用plus.io读取文件
|
||
try {
|
||
console.log('APP端开始读取文件:', filePath);
|
||
|
||
// 使用plus.io读取文件
|
||
plus.io.resolveLocalFileSystemURL(filePath, (entry) => {
|
||
entry.file((file) => {
|
||
const reader = new plus.io.FileReader();
|
||
reader.onloadend = (e) => {
|
||
const base64Data = e.target.result;
|
||
console.log('APP端文件转base64成功');
|
||
resolve(base64Data);
|
||
};
|
||
reader.onerror = (e) => {
|
||
console.error('APP端文件读取失败:', e);
|
||
resolve(filePath);
|
||
};
|
||
reader.readAsDataURL(file);
|
||
}, (error) => {
|
||
console.error('APP端文件获取失败:', error);
|
||
resolve(filePath);
|
||
});
|
||
}, (error) => {
|
||
console.error('APP端文件路径解析失败:', error);
|
||
resolve(filePath);
|
||
});
|
||
} catch (error) {
|
||
console.error('APP端文件处理异常:', error);
|
||
resolve(filePath);
|
||
}
|
||
// #endif
|
||
});
|
||
},
|
||
//删除附件
|
||
deleteImg(val, type) {
|
||
let that = this;
|
||
uni.showModal({
|
||
title: "提示",
|
||
content: "确定删除该附件吗?",
|
||
success: function(res) {
|
||
if (res.confirm) {
|
||
const objFn = {
|
||
1: "designChangeMaterial",
|
||
2: "safetyBriefingMaterial",
|
||
3: "technicalBriefingMaterial",
|
||
};
|
||
const findIndex = that[objFn[type]].findIndex(
|
||
(item) => item.url == val.url
|
||
);
|
||
if (findIndex > -1) {
|
||
that[objFn[type]].splice(findIndex, 1);
|
||
}
|
||
} else if (res.cancel) {
|
||
console.log("用户点击取消");
|
||
}
|
||
},
|
||
});
|
||
},
|
||
//预览文件
|
||
handlePreview(url) {
|
||
let type = url.split(".")[1];
|
||
const isUrl = url.includes("http://") ?
|
||
url :
|
||
this.url_config + "image/" + url;
|
||
if (
|
||
type == "doc" ||
|
||
type == "xls" ||
|
||
type == "ppt" ||
|
||
type == "pdf" ||
|
||
type == "docx" ||
|
||
type == "xlsx" ||
|
||
type == "pptx"
|
||
) {
|
||
uni.openDocument({
|
||
filePath: this.url_config + "image/" + url,
|
||
});
|
||
} else {
|
||
let fileList = [];
|
||
fileList = [isUrl];
|
||
uni.previewImage({
|
||
current: 0,
|
||
urls: fileList,
|
||
});
|
||
}
|
||
},
|
||
// 获取施工区域
|
||
getQualityRegionListFn() {
|
||
let that = this;
|
||
let data = {
|
||
projectSn: this.projectDetail.projectSn,
|
||
};
|
||
this.sendRequest({
|
||
url: "xmgl/qualityRegion/list",
|
||
method: "POST",
|
||
data: data,
|
||
success: (res) => {
|
||
if (res.code == 200) {
|
||
that.qualityRegionList = res.result;
|
||
}
|
||
},
|
||
});
|
||
},
|
||
// 获取施工单位
|
||
getEnterpriseInfoListFn() {
|
||
let that = this;
|
||
let data = {
|
||
projectSn: this.projectDetail.projectSn,
|
||
securityRegionIdList: this.workTicketInfo.constructionAreaIds,
|
||
};
|
||
this.sendRequest({
|
||
url: "xmgl/enterpriseInfo/list",
|
||
method: "POST",
|
||
data: data,
|
||
success: (res) => {
|
||
if (res.code == 200) {
|
||
that.enterpriseInfoList = res.result;
|
||
}
|
||
},
|
||
});
|
||
},
|
||
// 获取人员
|
||
getSelectWorkerInfoListFn() {
|
||
let that = this;
|
||
let data = {
|
||
projectSn: this.projectDetail.projectSn,
|
||
enterpriseId: this.workTicketInfo.constructionUnitIds.join(","),
|
||
};
|
||
this.sendRequest({
|
||
url: "xmgl/workerInfo/selectWorkerInfoList",
|
||
method: "POST",
|
||
data: data,
|
||
success: (res) => {
|
||
if (res.code == 200) {
|
||
that.selectWorkerInfoList = res.result.records;
|
||
}
|
||
},
|
||
});
|
||
},
|
||
// 获取监理单位
|
||
getProjectEnterpriseListFn() {
|
||
let that = this;
|
||
let data = {
|
||
projectSn: this.projectDetail.projectSn,
|
||
pageNo: 1,
|
||
pageSize: -1,
|
||
enterpriseTypeId: 7,
|
||
};
|
||
this.sendRequest({
|
||
url: "xmgl/projectEnterprise/list",
|
||
method: "POST",
|
||
data: data,
|
||
success: (res) => {
|
||
if (res.code == 200) {
|
||
that.cooperatorList = res.result.records;
|
||
}
|
||
},
|
||
});
|
||
},
|
||
// 获取监理人员
|
||
getSupervisionPersonnelListFn() {
|
||
let that = this;
|
||
let data = {
|
||
projectSn: this.projectDetail.projectSn,
|
||
enterpriseId: this.workTicketInfo.supervisionUnitIds,
|
||
};
|
||
this.sendRequest({
|
||
url: "xmgl/workerInfo/selectWorkerInfoList",
|
||
method: "POST",
|
||
data: data,
|
||
success: (res) => {
|
||
if (res.code == 200) {
|
||
that.supervisionPersonnelList = res.result.records;
|
||
}
|
||
},
|
||
});
|
||
},
|
||
// 获取天气
|
||
getWeather() {
|
||
let that = this;
|
||
let data = {
|
||
// projectSn: this.projectDetail.projectSn,
|
||
cityid: this.projectDetail.cityCode,
|
||
};
|
||
this.sendRequest({
|
||
url: "xmgl/airQualityAnalysis/getWeatherLiveData",
|
||
method: "POST",
|
||
data: data,
|
||
success: (res) => {
|
||
if (res.code == 200) {
|
||
if (res.result.errcode == 100) {
|
||
that.dealTypeShow = false;
|
||
} else {
|
||
const findIndex = this.winSpeedList.findIndex(
|
||
(item) => item.value == res.result.win_speed
|
||
);
|
||
this.defaultIndex = [findIndex];
|
||
that.workTicketInfo.weatherJson = res.result;
|
||
}
|
||
}
|
||
},
|
||
fail: (res) => {
|
||
that.dealTypeShow = false;
|
||
},
|
||
});
|
||
},
|
||
showToast(title, type) {
|
||
this.$refs.uToast.show({
|
||
title: title,
|
||
type: type,
|
||
});
|
||
},
|
||
},
|
||
computed: {
|
||
dateTimeUp() {
|
||
return (dateTime) => {
|
||
return dateTime == this.$dayjs().format("YYYY-MM-DD");
|
||
};
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.app-mask {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
background-color: rgba(0, 0, 0, 0.5);
|
||
z-index: 9998;
|
||
}
|
||
|
||
.app-guide-box {
|
||
position: absolute;
|
||
border: 2px solid red;
|
||
z-index: 9999;
|
||
}
|
||
|
||
.app-guideline {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
|
||
// 水平辅助线
|
||
&::before {
|
||
content: '';
|
||
position: absolute;
|
||
top: 50%;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 1px;
|
||
background-color: rgba(255, 255, 255, 0.5);
|
||
}
|
||
|
||
// 垂直辅助线
|
||
&::after {
|
||
content: '';
|
||
position: absolute;
|
||
left: 50%;
|
||
top: 0;
|
||
width: 1px;
|
||
height: 100%;
|
||
background-color: rgba(255, 255, 255, 0.5);
|
||
}
|
||
|
||
z-index: 9999;
|
||
}
|
||
|
||
.app-watermark {
|
||
position: absolute;
|
||
right: 20px;
|
||
bottom: 20px;
|
||
color: rgba(255, 255, 255, 0.8);
|
||
font-size: 16px;
|
||
z-index: 9999;
|
||
}
|
||
|
||
.content {
|
||
padding-bottom: 138rpx;
|
||
|
||
.content_main1 {
|
||
position: relative;
|
||
|
||
.main3_box {
|
||
padding: 26rpx 22rpx;
|
||
background-color: white;
|
||
margin-top: 26rpx;
|
||
|
||
.box-item {
|
||
padding: 20rpx 0;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
border-bottom: 2rpx solid #f2f2f2;
|
||
|
||
.box-item_right {
|
||
width: 40%;
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
align-items: center;
|
||
|
||
>view:first-child {
|
||
font-size: 24rpx;
|
||
color: #b3b3b3;
|
||
}
|
||
|
||
>view:nth-child(2) {
|
||
margin-left: 62rpx;
|
||
}
|
||
|
||
>view:nth-child(3) {
|
||
margin-left: 62rpx;
|
||
}
|
||
|
||
.icon-delete {
|
||
width: 32rpx;
|
||
height: 32rpx;
|
||
}
|
||
}
|
||
|
||
.box-item_left {
|
||
font-weight: 500;
|
||
font-size: 28rpx;
|
||
color: #3190f3;
|
||
width: 60%;
|
||
display: -webkit-box;
|
||
-webkit-box-orient: vertical;
|
||
-webkit-line-clamp: 1;
|
||
/* 限制为两行 */
|
||
overflow: hidden;
|
||
}
|
||
}
|
||
|
||
.box-header {
|
||
margin-bottom: 16rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
|
||
>view:last-child {
|
||
background: #5181f6;
|
||
border-radius: 6rpx;
|
||
padding: 16rpx 26rpx;
|
||
font-size: 28rpx;
|
||
color: #ffffff;
|
||
}
|
||
|
||
>view:first-child {
|
||
font-weight: 500;
|
||
font-size: 30rpx;
|
||
color: #1a1a1a;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.content_main {
|
||
// margin-top: 26rpx;
|
||
background-color: white;
|
||
|
||
.main-box {
|
||
padding: 0 16rpx;
|
||
|
||
.box2 {
|
||
font-size: 30rpx;
|
||
color: #1a1a1a;
|
||
padding: 20rpx 0 26rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
>image {
|
||
width: 40rpx;
|
||
height: 40rpx;
|
||
margin-right: 20rpx;
|
||
}
|
||
}
|
||
|
||
>.box1:not(:first-child) {
|
||
margin-top: 20rpx;
|
||
}
|
||
|
||
>.box1 {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
font-size: 28rpx;
|
||
font-weight: 500;
|
||
|
||
>view:first-child {
|
||
width: 148rpx;
|
||
color: #808080;
|
||
height: 68rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
>text {
|
||
color: #ff0000;
|
||
}
|
||
}
|
||
|
||
>view:last-child {
|
||
color: #4d4d4d;
|
||
min-height: 68rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
}
|
||
|
||
/deep/ .u-input {
|
||
width: 550rpx;
|
||
height: 68rpx;
|
||
line-height: 68rpx;
|
||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||
border: 2rpx solid #d8dbe8;
|
||
}
|
||
|
||
.changetime {
|
||
width: 550rpx;
|
||
height: 68rpx;
|
||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||
border: 2rpx solid #d8dbe8;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 0 34rpx;
|
||
font-size: 28rpx;
|
||
color: #4d4d4d;
|
||
|
||
.changetime_icon {
|
||
width: 36rpx;
|
||
height: 36rpx;
|
||
background-image: url("@/static/workTicketManage/index-icon7.png");
|
||
background-repeat: no-repeat;
|
||
background-size: 100% 100%;
|
||
}
|
||
}
|
||
|
||
.textarea {
|
||
position: relative;
|
||
|
||
/deep/ .u-input {
|
||
// height: 160rpx;
|
||
line-height: 68rpx;
|
||
min-height: 160rpx !important;
|
||
height: initial;
|
||
padding-bottom: 20px !important;
|
||
}
|
||
|
||
.textarea_text {
|
||
position: absolute;
|
||
right: 20rpx;
|
||
bottom: 20rpx;
|
||
font-size: 22rpx;
|
||
color: #b3b3b3;
|
||
}
|
||
}
|
||
}
|
||
|
||
.header-title {
|
||
padding: 12rpx 16rpx;
|
||
font-weight: 500;
|
||
font-size: 30rpx;
|
||
color: #1a1a1a;
|
||
margin-bottom: 20rpx;
|
||
// border-bottom: 2rpx solid #EFF3F7;
|
||
}
|
||
}
|
||
|
||
.confrim-btn {
|
||
width: 100%;
|
||
padding: 18rpx 26rpx;
|
||
background-color: #ffffff;
|
||
box-shadow: 0rpx -8rpx 8rpx 0rpx rgba(0, 0, 0, 0.05);
|
||
display: flex;
|
||
position: fixed;
|
||
bottom: 0;
|
||
z-index: 1;
|
||
|
||
>view {
|
||
width: 50%;
|
||
height: 76rpx;
|
||
font-weight: 500;
|
||
font-size: 28rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
>view:first-child {
|
||
background-color: rgba(81, 129, 246, 0.1);
|
||
border-radius: 6rpx 0rpx 0rpx 6rpx;
|
||
color: #5181f6;
|
||
}
|
||
|
||
>view:last-child {
|
||
background-color: #5181f6;
|
||
border-radius: 0rpx 6rpx 6rpx 0rpx;
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
}
|
||
|
||
/deep/ .u-mode-center-box {
|
||
width: 698rpx !important;
|
||
|
||
.u-model__title {
|
||
padding: 0;
|
||
font-size: 32rpx;
|
||
color: #272d45;
|
||
height: 86rpx;
|
||
background-color: #ffffff;
|
||
box-shadow: 0rpx 8rpx 10rpx -8rpx rgba(81, 129, 246, 0.42);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.u-model__content__message {
|
||
padding: 26rpx 26rpx 72rpx;
|
||
font-size: 28rpx;
|
||
color: #171717;
|
||
}
|
||
|
||
.u-model__footer__button {
|
||
height: 76rpx;
|
||
line-height: 76rpx;
|
||
background-color: rgba(81, 129, 246, 0.1);
|
||
font-weight: 500;
|
||
font-size: 28rpx;
|
||
color: #5181f6;
|
||
}
|
||
|
||
.hairline-left {
|
||
background-color: #5181f6;
|
||
color: white !important;
|
||
}
|
||
}
|
||
|
||
/deep/ .u-drawer-bottom {
|
||
border-radius: 32rpx 32rpx 0 0;
|
||
}
|
||
|
||
.content-popup {
|
||
.content-popup_main {
|
||
padding: 26rpx 0;
|
||
|
||
>view {
|
||
width: 100%;
|
||
height: 80rpx;
|
||
background-color: #ffffff;
|
||
font-weight: 500;
|
||
font-size: 30rpx;
|
||
color: #1a1a1a;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
>view:not(:first-child) {
|
||
margin-top: 20rpx;
|
||
}
|
||
|
||
.popup_main_active {
|
||
background-color: rgba(81, 129, 246, 0.1);
|
||
color: #5181f6;
|
||
}
|
||
}
|
||
|
||
uni-scroll-view {
|
||
margin: 26rpx 0;
|
||
}
|
||
|
||
.content-popup_header {
|
||
height: 86rpx;
|
||
box-shadow: 0rpx 8rpx 10rpx -8rpx rgba(81, 129, 246, 0.42);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-weight: 800;
|
||
font-size: 30rpx;
|
||
color: #1a1a1a;
|
||
}
|
||
|
||
.confrim-btn {
|
||
padding: 18rpx 26rpx;
|
||
background-color: #ffffff;
|
||
box-shadow: 0rpx -8rpx 8rpx 0rpx rgba(0, 0, 0, 0.05);
|
||
display: flex;
|
||
|
||
>view {
|
||
width: 50%;
|
||
height: 76rpx;
|
||
font-weight: 500;
|
||
font-size: 28rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
>view:first-child {
|
||
background-color: rgba(81, 129, 246, 0.1);
|
||
border-radius: 6rpx 0rpx 0rpx 6rpx;
|
||
color: #5181f6;
|
||
}
|
||
|
||
>view:last-child {
|
||
background-color: #5181f6;
|
||
border-radius: 0rpx 6rpx 6rpx 0rpx;
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
}
|
||
|
||
.addIssue {
|
||
min-height: 100vh;
|
||
background-color: #f2f3f7;
|
||
}
|
||
|
||
.fixedheader {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
z-index: 2;
|
||
|
||
/deep/ .headerBox {
|
||
border-bottom: none;
|
||
}
|
||
|
||
.headerName {
|
||
z-index: 1;
|
||
}
|
||
}
|
||
|
||
.new-nodata_height {
|
||
min-height: 500rpx;
|
||
position: relative;
|
||
}
|
||
|
||
.new-nodata {
|
||
position: absolute;
|
||
top: 50%;
|
||
left: 50%;
|
||
transform: translate(-50%, -50%);
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
>view {
|
||
width: 300rpx;
|
||
height: 300rpx;
|
||
background-image: url("@/static/staffAttendance/nodata.png");
|
||
background-repeat: no-repeat;
|
||
background-size: 100% 100%;
|
||
}
|
||
|
||
>text {
|
||
font-size: 22rpx;
|
||
color: #808080;
|
||
margin-top: 60rpx;
|
||
}
|
||
}
|
||
|
||
.content_main-box1 {
|
||
height: 224rpx;
|
||
// background-color: #FFFFFF;
|
||
padding: 26rpx;
|
||
|
||
/deep/ .uni-checkbox-input {
|
||
width: 32rpx;
|
||
height: 32rpx;
|
||
}
|
||
|
||
>view:last-child {
|
||
margin-top: 22rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
>image {
|
||
width: 80rpx;
|
||
height: 104rpx;
|
||
border-radius: 6rpx;
|
||
}
|
||
|
||
>view:last-child {
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: space-between;
|
||
margin-left: 40rpx;
|
||
height: 104rpx;
|
||
|
||
>view {
|
||
display: flex;
|
||
|
||
>view:first-child {
|
||
width: 84rpx;
|
||
font-size: 28rpx;
|
||
color: #4d4d4d;
|
||
text-align: right;
|
||
}
|
||
|
||
>view:last-child {
|
||
margin-left: 40rpx;
|
||
font-size: 28rpx;
|
||
color: #4d4d4d;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
>view:first-child {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
|
||
>view:first-child {
|
||
font-weight: 800;
|
||
font-size: 30rpx;
|
||
color: #171717;
|
||
}
|
||
|
||
>view:last-child {
|
||
width: 90rpx;
|
||
height: 42rpx;
|
||
background-color: rgba(71, 195, 147, 0.1);
|
||
border-radius: 76rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 21rpx;
|
||
color: #47c393;
|
||
}
|
||
|
||
.boundalready {
|
||
background-color: rgba(113, 75, 0, 0.1) !important;
|
||
color: #714b00 !important;
|
||
}
|
||
}
|
||
}
|
||
</style> |