PDA-安环管理-废水/废气巡检-页面对接

test
ysn 2 weeks ago
parent 06b8886855
commit 2b16285384
  1. 203
      pages/sanitation/gasInspection.vue
  2. 230
      pages/sanitation/waterInspection.vue

@ -2,122 +2,146 @@
<ifrm ref="ifrm"> <ifrm ref="ifrm">
<!-- 安全巡检--> <!-- 安全巡检-->
<uni-forms ref="form" err-show-type="toast"> <uni-forms ref="form" err-show-type="toast">
<uni-forms-item><input type="text" v-model="deviceRepairValue" @confirm="deviceRepairConfirm" <uni-forms-item>
class="uni-input-border" placeholder="巡检点编码" /></uni-forms-item> <input type="text" v-model="code" @confirm="deviceRepairConfirm" class="uni-input-border" placeholder="巡检点编码" />
</uni-forms-item>
</uni-forms> </uni-forms>
<t-table> <t-table>
<t-tr> <t-tr>
<t-td>巡检点编码</t-td> <t-td>巡检点编码</t-td>
<t-td>{{ deviceRepairObj.epInspectionPoint.patrolRegister }}</t-td> <t-td>{{ deviceRepairObj.epInspectionPoint.insNum }}</t-td>
</t-tr> </t-tr>
<t-tr> <t-tr>
<t-td>巡检点位置</t-td> <t-td>巡检点位置</t-td>
<t-td>{{ deviceRepairObj.epInspectionPoint.insSpot }}</t-td> <t-td>{{ deviceRepairObj.epInspectionPoint.insSite }}</t-td>
</t-tr> </t-tr>
<t-tr> <t-tr>
<t-td>状态</t-td> <t-td>状态</t-td>
<t-td>{{ deviceRepairObj.taskStatusText }}</t-td> <t-td>
{{
deviceRepairObj.epInspectionPoint.taskStatus == 1
? "待检"
: deviceRepairObj.epInspectionPoint.taskStatus == 2
? "未检"
: deviceRepairObj.epInspectionPoint.taskStatus == 3
? "已检"
: ""
}}
</t-td>
</t-tr> </t-tr>
</t-table> </t-table>
<view style="font-size: 36rpx;">巡检备注</view> <view style="font-size: 36rpx">巡检备注</view>
<uni-forms ref="form" err-show-type="toast"> <uni-forms ref="form" err-show-type="toast">
<uni-forms-item><uni-easyinput type="textarea" autoHeight v-model="deviceRepairObj.parMemo" <uni-forms-item>
placeholder="请输入内容"></uni-easyinput></uni-forms-item> <uni-easyinput type="textarea" autoHeight v-model="deviceRepairObj.epInspectionPoint.parMemo"
placeholder="请输入内容">
</uni-easyinput>
</uni-forms-item>
</uni-forms> </uni-forms>
<view class="photoTitleSize">{{uploader.length}}/9</view> <view class="photoTitleSize">{{ uploader.length }}/9</view>
<view class="showImage"> <view class="showImage">
<view v-for="(item, i) in uploader" :key="i" class="showImage-for"> <view v-for="(item, i) in uploader" :key="i" class="showImage-for">
<view class="view-image"> <view class="view-image">
<image :src="item.imageUrl" @tap="previewImage(i)" /> <image :src="item.imageUrl" @tap="previewImage(i)" />
</view> </view>
<view class="view-icon"> <view class="view-icon">
<uni-icons type='trash' size="14" color='gray' @click="removeScene(item, i)"></uni-icons> <uni-icons type="trash" size="14" color="gray" @click="removeScene(item, i)" />
</view> </view>
</view> </view>
<view class="view-center" v-if="uploader.length < 9"> <view class="view-center" v-if="uploader.length < 9">
<image src="../../static/images/photo.png" @click="chooseImage()"></image> <image src="../../static/images/photo.png" @click="chooseImage()" />
</view> </view>
</view> </view>
<view class="buttonBox"><button class="button" type="primary" <view class="buttonBox">
:disabled="!(Object.keys(deviceRepairObj).length > 2)" @click="submitClick">提交</button></view> <button class="button" type="primary" :disabled="!(Object.keys(deviceRepairObj.epInspectionPoint).length > 2)"
@click="submitClick">
提交
</button>
</view>
</ifrm> </ifrm>
</template> </template>
<script> <script>
import ifrm from '@/pages/index/ifrm'; import ifrm from "@/pages/index/ifrm";
import tTable from '@/components/t-table/t-table.vue'; import tTable from "@/components/t-table/t-table.vue";
import tTh from '@/components/t-table/t-th.vue'; import tTh from "@/components/t-table/t-th.vue";
import tTr from '@/components/t-table/t-tr.vue'; import tTr from "@/components/t-table/t-tr.vue";
import tTd from '@/components/t-table/t-td.vue'; import tTd from "@/components/t-table/t-td.vue";
import scan from '../../mixin/scan.js'; import scan from "../../mixin/scan.js";
export default { import {
options
} from '@/http/config.js';
export default {
mixins: [scan], mixins: [scan],
components: { components: {
ifrm, ifrm,
tTable, tTable,
tTh, tTh,
tTr, tTr,
tTd tTd,
}, },
data() { data() {
return { return {
deviceRepairValue: '', code: "",
deviceRepairObj: { deviceRepairObj: {
epInspectionPoint: {}, epInspectionPoint: {
parMemo: '' parMemo: "",
}, },
uploader: [] },
uploader: [],
}; };
}, },
methods: { methods: {
chooseImage: async function () {
chooseImage: async function() { if (!this.deviceRepairObj.epInspectionPoint.epcId) {
if (!this.deviceRepairObj.epiId) {
return uni.showToast({ return uni.showToast({
title: '请先查询巡检点', title: '请先查询巡检点',
icon: 'none' icon: 'none'
}); });
} }
uni.chooseImage({ uni.chooseImage({
// sourceType: ['album','camera'], //album camera 使
// sizeType: ['original', 'compressed'], //
count: 9, count: 9,
// sizeType: ['compressed'],
// sourceType: ['album', 'camera'],
success: (res) => { success: (res) => {
uni.showLoading({ uni.showLoading({
title: '上传中,请稍候' title: '上传中,请稍候'
}); });
var tempFilePaths = res.tempFilePaths; res.tempFilePaths.forEach(filePath => {
for (var i = 0; i < tempFilePaths.length; i++) { uni.uploadFile({
const file = res.tempFiles[i]; url: options.baseURL + '/blade-resource/oss/endpoint/put-file-attach',
this.$uploadUtil.upload(file, { filePath: filePath,
theId: this.deviceRepairObj.epiId, name: 'file',
theTag: 'EpPatrolInspection', header: {
subTag: 'appDoc' 'token': 'bearer ' + uni.getStorageSync('accessToken'),
}, tempFilePaths[i]).then((upId) => { 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken'),
'Blade-Requested-With': 'BladeHttpRequest'
},
success: (uploadRes) => {
uni.hideLoading(); uni.hideLoading();
// uni.showToast({ title: '上传成功' });
this.uploader.push({ this.uploader.push({
upId: upId, upId: JSON.parse(uploadRes.data).data.attachId,
imageUrl: file.path imageUrl: JSON.parse(uploadRes.data).data.link
}); });
})
}
}, },
complete() { fail: (err) => {
uni.hideLoading(); console.error('❌ 上传失败', err);
uni.showToast({ title: '上传失败', icon: 'none' });
} }
}) });
});
}, },
previewImage: function(index) { });
},
previewImage: function (index) {
var imags = []; var imags = [];
this.uploader.forEach(item => { this.uploader.forEach((item) => {
imags.push(item.imageUrl); imags.push(item.imageUrl);
}) });
uni.previewImage({ uni.previewImage({
current: index, current: index,
urls: imags urls: imags,
}) });
}, },
removeScene(item, i) { removeScene(item, i) {
@ -126,10 +150,10 @@
// // // //
this.$uploadUtil.asyncDelete(item.upId).then((data) => { this.$uploadUtil.asyncDelete(item.upId).then((data) => {
uni.showToast({ uni.showToast({
title: '删除成功', title: "删除成功",
icon: 'none' icon: "none",
});
}); });
})
// this.upIdList.splice(this.upIdList.findIndex((upId) => (upId === item.upId)), 1); // this.upIdList.splice(this.upIdList.findIndex((upId) => (upId === item.upId)), 1);
}, },
@ -140,68 +164,64 @@
this.getBarCode(e.target.value); this.getBarCode(e.target.value);
}, },
getData(code) { getData(code) {
this.deviceRepairValue = code; this.code = code;
this.$ajax.request({ this.$u.api
url: 'pdaLoad/getInspectionBySan', .getInspectionBySan({
method: 'POST',
data: {
code: code, code: code,
eipType: 2 eipType: 2,
}, })
success: data => { .then((res) => {
if (data == null) { if (res.data == null) {
return uni.showToast({ return uni.showToast({
icon: "none", icon: "none",
title: '此巡检位置暂无任务' title: "此巡检位置暂无任务",
}); });
} }
this.deviceRepairValue = ''; this.code = "";
this.deviceRepairObj = data; this.deviceRepairObj.epInspectionPoint = res.data;
uni.showToast({ uni.showToast({
title: '数据获取成功' title: "数据获取成功",
}); });
}
}); });
}, },
submitClick() { submitClick() {
this.$ajax.request({ this.$u.api
url: 'pdaSave/savePatrolIns', .savePatrolIns({
method: 'POST', ...this.deviceRepairObj.epInspectionPoint,
data: this.deviceRepairObj, path: this.uploader.map((item) => item.imageUrl).join(','),
success: data => { })
.then((data) => {
uni.showToast({ uni.showToast({
title: '保存成功' title: "保存成功",
}); });
this.deviceRepairValue = ''; this.code = "";
this.deviceRepairObj = { this.deviceRepairObj = {
epInspectionPoint: {}, epInspectionPoint: {},
parMemo: ''
}; };
this.uploader = [] this.uploader = [];
}
}); });
} },
}, },
onNavigationBarButtonTap(btn) { onNavigationBarButtonTap(btn) {
this.$refs.ifrm.topMenuClick(btn); this.$refs.ifrm.topMenuClick(btn);
}, },
onShow() {} onShow() { },
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.uni-forms-item { .uni-forms-item {
margin-bottom: 6px !important; margin-bottom: 6px !important;
} }
.photoTitleSize { .photoTitleSize {
color: #a1a1a1; color: #a1a1a1;
text-align: right; text-align: right;
margin-right: 30rpx; margin-right: 30rpx;
margin-top: -30rpx; margin-top: -30rpx;
} }
.showImage { .showImage {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: flex-start; justify-content: flex-start;
@ -209,7 +229,6 @@
margin-left: -20rpx; margin-left: -20rpx;
.showImage-for { .showImage-for {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 200rpx; width: 200rpx;
@ -232,9 +251,9 @@
height: 190rpx; height: 190rpx;
} }
} }
} }
.view-center { .view-center {
margin: 0rpx 25rpx; margin: 0rpx 25rpx;
image { image {
@ -245,5 +264,5 @@
width: 190rpx; width: 190rpx;
height: 190rpx; height: 190rpx;
} }
} }
</style> </style>

@ -2,122 +2,165 @@
<ifrm ref="ifrm"> <ifrm ref="ifrm">
<!-- 安全巡检--> <!-- 安全巡检-->
<uni-forms ref="form" err-show-type="toast"> <uni-forms ref="form" err-show-type="toast">
<uni-forms-item><input type="text" v-model="deviceRepairValue" @confirm="deviceRepairConfirm" <uni-forms-item>
class="uni-input-border" placeholder="巡检点编码" /></uni-forms-item> <input
type="text"
v-model="code"
@confirm="deviceRepairConfirm"
class="uni-input-border"
placeholder="巡检点编码"
/>
</uni-forms-item>
</uni-forms> </uni-forms>
<t-table> <t-table>
<t-tr> <t-tr>
<t-td>巡检点编码</t-td> <t-td>巡检点编码</t-td>
<t-td>{{ deviceRepairObj.epInspectionPoint.patrolRegister }}</t-td> <t-td>{{ deviceRepairObj.epInspectionPoint.insNum }}</t-td>
</t-tr> </t-tr>
<t-tr> <t-tr>
<t-td>巡检点位置</t-td> <t-td>巡检点位置</t-td>
<t-td>{{ deviceRepairObj.epInspectionPoint.insSpot }}</t-td> <t-td>{{ deviceRepairObj.epInspectionPoint.insSite }}</t-td>
</t-tr> </t-tr>
<t-tr> <t-tr>
<t-td>状态</t-td> <t-td>状态</t-td>
<t-td>{{ deviceRepairObj.taskStatusText }}</t-td> <t-td>
{{
deviceRepairObj.epInspectionPoint.taskStatus == 1
? "待检"
: deviceRepairObj.epInspectionPoint.taskStatus == 2
? "未检"
: deviceRepairObj.epInspectionPoint.taskStatus == 3
? "已检"
: ""
}}
</t-td>
</t-tr> </t-tr>
</t-table> </t-table>
<view style="font-size: 36rpx;">巡检备注</view> <view style="font-size: 36rpx">巡检备注</view>
<uni-forms ref="form" err-show-type="toast"> <uni-forms ref="form" err-show-type="toast">
<uni-forms-item><uni-easyinput type="textarea" autoHeight v-model="deviceRepairObj.parMemo" <uni-forms-item>
placeholder="请输入内容"></uni-easyinput></uni-forms-item> <uni-easyinput
type="textarea"
autoHeight
v-model="deviceRepairObj.epInspectionPoint.parMemo"
placeholder="请输入内容"
>
</uni-easyinput>
</uni-forms-item>
</uni-forms> </uni-forms>
<view class="photoTitleSize">{{uploader.length}}/9</view> <view class="photoTitleSize">{{ uploader.length }}/9</view>
<view class="showImage"> <view class="showImage">
<view v-for="(item, i) in uploader" :key="i" class="showImage-for"> <view v-for="(item, i) in uploader" :key="i" class="showImage-for">
<view class="view-image"> <view class="view-image">
<image :src="item.imageUrl" @tap="previewImage(i)" /> <image :src="item.imageUrl" @tap="previewImage(i)" />
</view> </view>
<view class="view-icon"> <view class="view-icon">
<uni-icons type='trash' size="14" color='gray' @click="removeScene(item, i)"></uni-icons> <uni-icons
type="trash"
size="14"
color="gray"
@click="removeScene(item, i)"
/>
</view> </view>
</view> </view>
<view class="view-center" v-if="uploader.length < 9"> <view class="view-center" v-if="uploader.length < 9">
<image src="../../static/images/photo.png" @click="chooseImage()"></image> <image src="../../static/images/photo.png" @click="chooseImage()" />
</view> </view>
</view> </view>
<view class="buttonBox"><button class="button" type="primary" <view class="buttonBox">
:disabled="!(Object.keys(deviceRepairObj).length > 2)" @click="submitClick">提交</button></view> <button
class="button"
type="primary"
:disabled="!(Object.keys(deviceRepairObj.epInspectionPoint).length > 2)"
@click="submitClick"
>
提交
</button>
</view>
</ifrm> </ifrm>
</template> </template>
<script> <script>
import ifrm from '@/pages/index/ifrm'; import ifrm from "@/pages/index/ifrm";
import tTable from '@/components/t-table/t-table.vue'; import tTable from "@/components/t-table/t-table.vue";
import tTh from '@/components/t-table/t-th.vue'; import tTh from "@/components/t-table/t-th.vue";
import tTr from '@/components/t-table/t-tr.vue'; import tTr from "@/components/t-table/t-tr.vue";
import tTd from '@/components/t-table/t-td.vue'; import tTd from "@/components/t-table/t-td.vue";
import scan from '../../mixin/scan.js'; import scan from "../../mixin/scan.js";
export default { import { options } from "@/http/config.js";
export default {
mixins: [scan], mixins: [scan],
components: { components: {
ifrm, ifrm,
tTable, tTable,
tTh, tTh,
tTr, tTr,
tTd tTd,
}, },
data() { data() {
return { return {
deviceRepairValue: '', code: "",
deviceRepairObj: { deviceRepairObj: {
epInspectionPoint: {}, epInspectionPoint: {
parMemo: '' parMemo: "",
}, },
uploader: [] },
uploader: [],
}; };
}, },
methods: { methods: {
chooseImage: async function () {
chooseImage: async function() { if (!this.deviceRepairObj.epInspectionPoint.epcId) {
if (!this.deviceRepairObj.epiId) {
return uni.showToast({ return uni.showToast({
title: '请先查询巡检点', title: "请先查询巡检点",
icon: 'none' icon: "none",
}); });
} }
uni.chooseImage({ uni.chooseImage({
// sourceType: ['album','camera'], //album camera 使
// sizeType: ['original', 'compressed'], //
count: 9, count: 9,
// sizeType: ['compressed'],
// sourceType: ['album', 'camera'],
success: (res) => { success: (res) => {
uni.showLoading({ uni.showLoading({
title: '上传中,请稍候' title: "上传中,请稍候",
}); });
var tempFilePaths = res.tempFilePaths; res.tempFilePaths.forEach((filePath) => {
for (var i = 0; i < tempFilePaths.length; i++) { uni.uploadFile({
const file = res.tempFiles[i]; url:
this.$uploadUtil.upload(file, { options.baseURL +
theId: this.deviceRepairObj.epiId, "/blade-resource/oss/endpoint/put-file-attach",
theTag: 'EpPatrolInspection', filePath: filePath,
subTag: 'appDoc' name: "file",
}, tempFilePaths[i]).then((upId) => { header: {
token: "bearer " + uni.getStorageSync("accessToken"),
"Blade-Auth": "bearer " + uni.getStorageSync("accessToken"),
"Blade-Requested-With": "BladeHttpRequest",
},
success: (uploadRes) => {
uni.hideLoading(); uni.hideLoading();
// uni.showToast({ title: "上传成功" });
this.uploader.push({ this.uploader.push({
upId: upId, upId: JSON.parse(uploadRes.data).data.attachId,
imageUrl: file.path imageUrl: JSON.parse(uploadRes.data).data.link,
}); });
})
}
}, },
complete() { fail: (err) => {
uni.hideLoading(); console.error("❌ 上传失败", err);
} uni.showToast({ title: "上传失败", icon: "none" });
})
}, },
previewImage: function(index) { });
});
},
});
},
previewImage: function (index) {
var imags = []; var imags = [];
this.uploader.forEach(item => { this.uploader.forEach((item) => {
imags.push(item.imageUrl); imags.push(item.imageUrl);
}) });
uni.previewImage({ uni.previewImage({
current: index, current: index,
urls: imags urls: imags,
}) });
}, },
removeScene(item, i) { removeScene(item, i) {
@ -126,10 +169,10 @@
// // // //
this.$uploadUtil.asyncDelete(item.upId).then((data) => { this.$uploadUtil.asyncDelete(item.upId).then((data) => {
uni.showToast({ uni.showToast({
title: '删除成功', title: "删除成功",
icon: 'none' icon: "none",
});
}); });
})
// this.upIdList.splice(this.upIdList.findIndex((upId) => (upId === item.upId)), 1); // this.upIdList.splice(this.upIdList.findIndex((upId) => (upId === item.upId)), 1);
}, },
@ -140,68 +183,64 @@
this.getBarCode(e.target.value); this.getBarCode(e.target.value);
}, },
getData(code) { getData(code) {
this.deviceRepairValue = code; this.code = code;
this.$ajax.request({ this.$u.api
url: 'pdaLoad/getInspectionBySan', .getInspectionBySan({
method: 'POST',
data: {
code: code, code: code,
eipType: 1 eipType: 1,
}, })
success: data => { .then((res) => {
if (data == null) { if (res.data == null) {
return uni.showToast({ return uni.showToast({
icon: "none", icon: "none",
title: '此巡检位置暂无任务' title: "此巡检位置暂无任务",
}); });
} }
this.deviceRepairValue = ''; this.code = "";
this.deviceRepairObj = data; this.deviceRepairObj.epInspectionPoint = res.data;
uni.showToast({ uni.showToast({
title: '数据获取成功' title: "数据获取成功",
}); });
}
}); });
}, },
submitClick() { submitClick() {
this.$ajax.request({ this.$u.api
url: 'pdaSave/savePatrolIns', .savePatrolIns({
method: 'POST', ...this.deviceRepairObj.epInspectionPoint,
data: this.deviceRepairObj, path: this.uploader.map((item) => item.imageUrl).join(","),
success: data => { })
.then((data) => {
uni.showToast({ uni.showToast({
title: '保存成功' title: "保存成功",
}); });
this.deviceRepairValue = ''; this.code = "";
this.deviceRepairObj = { this.deviceRepairObj = {
epInspectionPoint: {}, epInspectionPoint: {},
parMemo: ''
}; };
this.uploader = [] this.uploader = [];
}
}); });
} },
}, },
onNavigationBarButtonTap(btn) { onNavigationBarButtonTap(btn) {
this.$refs.ifrm.topMenuClick(btn); this.$refs.ifrm.topMenuClick(btn);
}, },
onShow() {} onShow() {},
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.uni-forms-item { .uni-forms-item {
margin-bottom: 6px !important; margin-bottom: 6px !important;
} }
.photoTitleSize { .photoTitleSize {
color: #a1a1a1; color: #a1a1a1;
text-align: right; text-align: right;
margin-right: 30rpx; margin-right: 30rpx;
margin-top: -30rpx; margin-top: -30rpx;
} }
.showImage { .showImage {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: flex-start; justify-content: flex-start;
@ -209,7 +248,6 @@
margin-left: -20rpx; margin-left: -20rpx;
.showImage-for { .showImage-for {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 200rpx; width: 200rpx;
@ -232,9 +270,9 @@
height: 190rpx; height: 190rpx;
} }
} }
} }
.view-center { .view-center {
margin: 0rpx 25rpx; margin: 0rpx 25rpx;
image { image {
@ -245,5 +283,5 @@
width: 190rpx; width: 190rpx;
height: 190rpx; height: 190rpx;
} }
} }
</style> </style>
Loading…
Cancel
Save