| | |
| | | <block slot="content">执行</block> |
| | | </cu-custom> |
| | | <view class="container"> |
| | | <template> |
| | | <!-- 浮窗遮罩层 --> |
| | | <view v-if="showPreview" class="overlay" @tap.stop="closePreview"> |
| | | <view class="modal"> |
| | | <!-- 关闭按钮 --> |
| | | <text class="close-btn" @tap.stop="showPreview = false">×</text> |
| | | <!-- 图片展示 --> |
| | | <image :src="previewImageSrc" mode="aspectFit" class="preview-image" /> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | </template> |
| | | <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> |
| | | <uni-group top="1"> |
| | | <view class="text-gray margin-bottom-lg">—————————— 基本信息 ——————————</view> |
| | | <view class="divider"><text>基本信息</text></view> |
| | | <!-- <view class="text-gray margin-bottom-lg">—————————— 基本信息 ——————————</view> --> |
| | | <uni-forms-item :label-width="80" name="orderNum" label="工单号:"> |
| | | <uni-easyinput v-model="formData.orderNum" :disabled="true" /> |
| | | </uni-forms-item> |
| | |
| | | <uni-easyinput type="textarea" v-model="formData.remark" :disabled="true" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="80" name="outNum" label="点检图片:"> |
| | | <view class="grid col-4 grid-square flex-sub"> |
| | | <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" |
| | | :data-url="imgList[index]"> |
| | | <image :src="imgList[index]" mode="aspectFill"></image> |
| | | <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> |
| | | <text class='cuIcon-close'></text> |
| | | </view> |
| | | </view> |
| | | <view class="solids" @tap="ChooseImage" v-if="imgList.length<1"> |
| | | <text class='cuIcon-cameraadd'></text> |
| | | </view> |
| | | </view> |
| | | |
| | | <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" |
| | | :sourceType="sourceType" @select="select" @progress="progress" @success="success" |
| | | @fail="fail" @delete="deletea" /> |
| | | </uni-forms-item> |
| | | <!-- <view class="text-gray margin-bottom-lg">—————————— 班组长确认 ——————————</view> |
| | | <uni-forms-item name="outNum" required label="确认类型:"> |
| | | <uni-data-select :localdata="formData.msListCategory" popup-title="请选择" @change="changeType" |
| | | :clear="false"> |
| | | </uni-data-select> |
| | | <uni-forms-item name="outNum" :label-width="80" label="作业指导:"> |
| | | <button class="cu-btn bg-blue" @tap="showPreview = true">查看</button> |
| | | </uni-forms-item> |
| | | <uni-forms-item name="outNum" required label="确认意见:"> |
| | | <uni-easyinput type="textarea" v-model="formData.ttitle" placeholder="请输入内容"></uni-easyinput> |
| | | </uni-forms-item> --> |
| | | </uni-group> |
| | | </uni-forms> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <view class="text-gray margin-bottom-lg">——————————保养项信息—————————————</view> |
| | | |
| | | |
| | | <view class="divider"><text>保养项信息</text></view> |
| | | <view class="padding flex flex-direction"> |
| | | <button :disabled="isClick" class="mini-btn" type="primary" @click.stop="batchnsIpection()" |
| | | size="mini">批量点检正常</button> |
| | |
| | | {{item.itemName}} |
| | | </view> |
| | | </view> |
| | | <!-- <view class="flex"> |
| | | <view class="flex-sub text-light bg-white padding-xs margin-xs radius">子保养项:</view> |
| | | <view class="flex-sub bg-white padding-xs margin-xs radius text-right" |
| | | v-if="item.small!=null && item.small.length>10"> |
| | | {{(item.small).toString().substr(0,10)+'...'}} |
| | | </view> |
| | | |
| | | <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> |
| | | {{item.small}} |
| | | </view> |
| | | </view> --> |
| | | |
| | | <view class="flex"> |
| | | <view class="flex-sub text-light bg-white padding-xs margin-xs radius">保养要求:</view> |
| | | <view class="flex-sub bg-white padding-xs margin-xs radius text-right" |
| | | <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" |
| | | v-if="item.itemDemand!=null && item.itemDemand.length>10"> |
| | | {{(item.itemDemand).toString().substr(0,10)+'...'}} |
| | | </view> |
| | | |
| | | <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> |
| | | {{item.itemDemand}} |
| | | </view> |
| | | </view> |
| | | <view class="flex"> |
| | | <view class="flex-sub text-light bg-white padding-xs margin-xs radius">异常是否报修:</view> |
| | | <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> |
| | | <uni-data-select :localdata="item.type" v-model="item.reportFlag" |
| | | :disabled="item.istrue" /> |
| | | </view> --> |
| | | <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> |
| | | {{item.itemDemand}} |
| | | </view> |
| | | </view> |
| | | <view class="flex"> |
| | |
| | | <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> |
| | | <uni-data-select :localdata="item.restle" v-model="item.inspectionResult" |
| | | @change="handleCode($event, index)" /> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="flex"> |
| | | <view class="flex-sub text-light bg-white padding-xs margin-xs radius">异常是否报修:</view> |
| | | <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> |
| | | <uni-data-select :localdata="item.type" @change="handleType($event, index)" |
| | | v-model="item.reportFlag" :disabled="item.istrue" /> |
| | | </view> |
| | | </view> |
| | | |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import index from "../../../../store"; |
| | | import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; |
| | | import configService from "@/common/service/config.service.js"; |
| | | export default { |
| | | mixins: [MescrollMixin], // 使用mixin |
| | | data() { |
| | | return { |
| | | showPreview: false, |
| | | // 图片回显 |
| | | fileLists: [], |
| | | // 上传图片的样式 |
| | | imageStyles: { |
| | | width: 90, |
| | | height: 90, |
| | | }, |
| | | sourceType: ['album', 'camera'], |
| | | isClick: false, |
| | | scrollLeft: 0, |
| | | ipAndPort: configService.staticURL, |
| | | searchValue: '', |
| | | imgList: [], |
| | | equipmentList: [], |
| | |
| | | upload: "/eam/sysFiles/batch_upload", |
| | | stallList: "/eam/eamInspectionOrder/queryById", |
| | | getEquipmentList: 'eam/equipment/list', |
| | | // getEquipmentList: "eam/equipment/asyncLoadEquipment", |
| | | getStandardFile: "eam/maintenanceStandard/queryById", |
| | | BaoList: 'eam/eamInspectionOrderDetail/queryList', |
| | | approval: 'eam/eamInspectionOrder/approval' |
| | | }, |
| | | previewImageSrc: '', |
| | | standardId: '', |
| | | id: '', |
| | | taskId: '', |
| | | inspectionResult: '', |
| | |
| | | }, |
| | | |
| | | methods: { |
| | | select(e) { |
| | | const tempFilePaths = e.tempFilePaths; |
| | | uni.showLoading({ |
| | | title: '上传中...' |
| | | }); |
| | | |
| | | const uploadPromises = tempFilePaths.map((filePath, index) => { |
| | | return new Promise((resolve, reject) => { |
| | | this.$http.upload(this.url.upload, { |
| | | filePath: filePath, |
| | | name: 'file' |
| | | }) |
| | | .then(uploadRes => { |
| | | // 假设服务器返回的结果中包含文件路径 |
| | | const serverFilePath = uploadRes.data.result[0]; |
| | | this.formData.avatar.push(serverFilePath); |
| | | resolve(uploadRes); // 返回结果给 Promise.all |
| | | }) |
| | | .catch(err => { |
| | | console.error(`图片 ${index + 1} 上传失败:`, err); |
| | | reject(err); |
| | | }); |
| | | }); |
| | | }); |
| | | |
| | | Promise.all(uploadPromises) |
| | | .then(() => { |
| | | uni.hideLoading(); |
| | | uni.showToast({ |
| | | title: '全部上传成功' |
| | | }); |
| | | }) |
| | | .catch(err => { |
| | | uni.hideLoading(); |
| | | uni.showToast({ |
| | | title: '部分上传失败', |
| | | icon: 'none' |
| | | }); |
| | | console.error('上传异常:', err); |
| | | }); |
| | | }, |
| | | |
| | | // 删除 |
| | | deletea(e) { |
| | | console.log('删除图片', e); |
| | | }, |
| | | batchnsIpection() { |
| | | uni.showModal({ |
| | | title: '提示', |
| | |
| | | .partTakeAdviceDetailList[i] |
| | | .inspectionResult == null || this |
| | | .partTakeAdviceDetailList[i].inspectionResult == '') { |
| | | /* this.$tip.error("请输入领料数量!"); */ |
| | | uni.showToast({ |
| | | icon: 'none', |
| | | title: '点检结果不能为空' |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | for (let i = 0; i < this.partTakeAdviceDetailList.length; i++) { |
| | | if (this.partTakeAdviceDetailList[i].inspectionResult === "2") { |
| | | if (this.partTakeAdviceDetailList[i].reportFlag === undefined || this |
| | | .partTakeAdviceDetailList[i].reportFlag === null || this.partTakeAdviceDetailList[i] |
| | | .reportFlag === '') { |
| | | const index = i + 1 |
| | | uni.showModal({ |
| | | title: "提示", |
| | | content: '第' + index + '行号异常报修必选', |
| | | confirmText: '确定', |
| | | showCancel: false, |
| | | }) |
| | | |
| | | return false; |
| | | |
| | | } |
| | | if (this.partTakeAdviceDetailList[i].exceptionDescription == undefined || this |
| | | .partTakeAdviceDetailList[i].exceptionDescription == null || this |
| | | .partTakeAdviceDetailList[i].exceptionDescription == '') { |
| | | const index = i + 1 |
| | | uni.showModal({ |
| | | title: "提示", |
| | | content: '第' + index + '行号异常描述需填写', |
| | | confirmText: '确定', |
| | | showCancel: false, |
| | | }) |
| | | return false; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | uni.showLoading({ |
| | | mask: true, |
| | |
| | | title: '提交成功', |
| | | duration: 2000 |
| | | }); |
| | | // this.$Router.replace({ |
| | | // name: 'ToDoList' |
| | | // }) |
| | | this.$Router.replaceAll({ |
| | | name: 'ToDoList' |
| | | }) |
| | |
| | | } |
| | | |
| | | }, |
| | | |
| | | closePreview() { |
| | | this.showPreview = false; |
| | | }, |
| | | changeEquipmentList(e) { |
| | | this.formData.num = e; |
| | | }, |
| | |
| | | this.partTakeAdviceDetailList[index].istrue = true; |
| | | } |
| | | }, |
| | | // getEquipment() { |
| | | // this.$http.get(this.url.getEquipmentList).then(res => { |
| | | // //设置列表数据 |
| | | // if (res.data.success) { |
| | | // this.equipmentList = res.data.result |
| | | // } else { |
| | | // uni.showToast({ |
| | | // icon: "error", |
| | | // title: res.data.message, |
| | | // duration: 2000 |
| | | // }); |
| | | |
| | | // } |
| | | // }).catch(() => { |
| | | // this.$tip.error("联网失败") |
| | | // }) |
| | | // }, |
| | | |
| | | handleType(e, index) { |
| | | console.log(e) |
| | | }, |
| | | getEquipment() { |
| | | this.$http.get(this.url.getEquipmentList, { |
| | | params: { |
| | |
| | | //联网失败, 结束加载 |
| | | }) |
| | | }, |
| | | ChooseImage() { |
| | | var that = this; |
| | | uni.chooseImage({ |
| | | count: 4, |
| | | sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 |
| | | sourceType: ['album'], // 从相册选择 |
| | | success: (res) => { |
| | | // 存储选择的图片路径 |
| | | that.imgList = res.tempFilePaths; |
| | | |
| | | // 初始化 formData.avatar 为空字符串 |
| | | that.formData.avatar = []; |
| | | |
| | | // 创建上传任务的 Promise 数组 |
| | | const uploadPromises = res.tempFilePaths.map((filePath, index) => { |
| | | return new Promise((resolve, reject) => { |
| | | that.$http.upload(that.url.upload, { |
| | | filePath: filePath, |
| | | name: 'file' |
| | | }) |
| | | .then(uploadRes => { |
| | | const filePath = uploadRes.data.result[0]; |
| | | this.formData.avatar.push(filePath); |
| | | console.log(this.formData.avatar) |
| | | resolve(filePath); |
| | | }) |
| | | .catch(err => { |
| | | console.error('图片' + index + '上传失败:', err); |
| | | reject(err); |
| | | }); |
| | | }); |
| | | }); |
| | | |
| | | // 并发执行所有上传任务 |
| | | Promise.all(uploadPromises) |
| | | .then((uploadedFilePaths) => { |
| | | console.log('所有图片上传成功:', that.formData.avatar); |
| | | }) |
| | | .catch((err) => { |
| | | console.error('图片上传失败:', err); |
| | | that.$tip.error('图片上传失败'); |
| | | }); |
| | | getStandardFile() { |
| | | this.$http.get(this.url.getStandardFile, { |
| | | params: { |
| | | id: this.standardId |
| | | } |
| | | }); |
| | | }, |
| | | ViewImage(e) { |
| | | uni.previewImage({ |
| | | urls: this.imgList, |
| | | current: e.currentTarget.dataset.url |
| | | }); |
| | | }, |
| | | DelImg(e) { |
| | | uni.showModal({ |
| | | title: '提示', |
| | | content: '确定要删除这段回忆吗?', |
| | | cancelText: '再看看', |
| | | confirmText: '再见', |
| | | success: res => { |
| | | if (res.confirm) { |
| | | this.imgList.splice(e.currentTarget.dataset.index, 1) |
| | | }).then(res => { |
| | | if (res.data.success) { |
| | | console.log("res", res.data.result); |
| | | const referenceFileStr = res.data.result.referenceFile; |
| | | |
| | | // 判断是否存在 referenceFile 并进行解析 |
| | | if (referenceFileStr) { |
| | | try { |
| | | const referenceFileObj = JSON.parse(referenceFileStr); |
| | | const filePath = `${this.ipAndPort}${referenceFileObj.filePath}`; |
| | | this.previewImageSrc = filePath; |
| | | console.log('previewImageSrc:', this.previewImageSrc); |
| | | } catch (e) { |
| | | console.error("referenceFile 解析失败", e); |
| | | this.previewImageSrc = ''; |
| | | } |
| | | } else { |
| | | console.warn("referenceFile 不存在"); |
| | | this.previewImageSrc = ''; |
| | | } |
| | | } |
| | | }) |
| | | }).catch(err => { |
| | | console.error("网络请求失败", err); |
| | | // 联网失败, 结束加载 |
| | | }); |
| | | }, |
| | | |
| | | upCallback() { |
| | | this.$http.get(this.url.stallList, { |
| | | params: { |
| | |
| | | //设置列表数据 |
| | | if (res.data.success) { |
| | | console.log("res", res.data.result.equipmentCode) |
| | | this.formData.num = this.announcement1.equipmentId, |
| | | this.formData.orderNum = this.announcement1.orderNum, |
| | | this.formData.operator = this.announcement1.operator, |
| | | this.formData.inspectionDate = this.announcement1.inspectionDate |
| | | if (this.announcement1.standardId !== null) { |
| | | this.standardId = this.announcement1.standardId |
| | | this.getStandardFile() |
| | | } |
| | | this.formData.num = this.announcement1.equipmentId |
| | | this.formData.remark = this.announcement1.remark |
| | | this.formData.orderNum = this.announcement1.orderNum |
| | | this.formData.operator = this.announcement1.operator |
| | | this.formData.inspectionDate = this.announcement1.inspectionDate |
| | | this.hasInspectionDateArrived(); |
| | | |
| | | |
| | |
| | | border-color: #179b16; |
| | | } |
| | | |
| | | .divider { |
| | | display: flex; |
| | | align-items: center; |
| | | text-align: center; |
| | | color: gray; |
| | | /* 文字颜色 */ |
| | | margin: 20px 0; |
| | | /* 上下间距 */ |
| | | } |
| | | |
| | | .divider::before, |
| | | .divider::after { |
| | | content: ''; |
| | | flex: 1; |
| | | border-bottom: 1px solid gray; |
| | | /* 横线颜色 */ |
| | | margin: 0 16px; |
| | | /* 横线与文字之间的间距 */ |
| | | } |
| | | |
| | | .divider text { |
| | | white-space: nowrap; |
| | | /* 防止文字换行 */ |
| | | } |
| | | |
| | | .content { |
| | | margin-top: 5px; |
| | |
| | | margin-top: 85px; |
| | | height: auto; |
| | | } |
| | | |
| | | .overlay { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | background-color: rgba(0, 0, 0, 0.7); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | z-index: 999; |
| | | } |
| | | |
| | | .modal { |
| | | position: relative; |
| | | width: 90%; |
| | | max-width: 600px; |
| | | background: #fff; |
| | | border-radius: 12rpx; |
| | | padding: 20rpx; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .preview-image { |
| | | width: 100%; |
| | | max-height: 80vh; |
| | | object-fit: contain; |
| | | } |
| | | |
| | | .close-btn { |
| | | position: absolute; |
| | | top: 10rpx; |
| | | right: 20rpx; |
| | | font-size: 40rpx; |
| | | color: #333; |
| | | } |
| | | </style> |