Browse Source

水电

fenbao
wangyx 1 month ago
parent
commit
67f124067d
  1. 10
      pages/tabBar/work/index.vue
  2. 79
      pagesA/sdPage/dfReport.vue

10
pages/tabBar/work/index.vue

@ -22,7 +22,7 @@
</view> </view>
</view> </view>
<view class="conItem" style="display: none;"> <view class="conItem" >
<view class="conItem-title">水电</view> <view class="conItem-title">水电</view>
<view class="conItem-cont"> <view class="conItem-cont">
<view class="conItem-cont-item" v-for="(item, index) in sdList" :key="index" @click="handelSdClick(item)"> <view class="conItem-cont-item" v-for="(item, index) in sdList" :key="index" @click="handelSdClick(item)">
@ -70,10 +70,10 @@ export default {
{ image: '/static/img/巡查.png', text: '巡检上报' }, { image: '/static/img/巡查.png', text: '巡检上报' },
{ image: '/static/img/记录.png', text: '巡检记录' }, { image: '/static/img/记录.png', text: '巡检记录' },
], ],
// sdList: [ sdList: [
// { image: '/static/img/.png', text: '' }, { image: '/static/img/水费.png', text: '水量上报' },
// { image: '/static/img/.png', text: '' }, { image: '/static/img/电费.png', text: '电量上报' },
// ], ],
// bxList: [ // bxList: [
// { image: '/static/img/.png', text: '' }, // { image: '/static/img/.png', text: '' },
// { image: '/static/img/.png', text: '' }, // { image: '/static/img/.png', text: '' },

79
pagesA/sdPage/dfReport.vue

@ -51,7 +51,7 @@
:value="multiIndex" :value="multiIndex"
:range="multiArray" :range="multiArray"
> >
<view class="uni-input">{{ <view class="uni-input">{{multiIndex[0]?'请选择':
multiArray[0][multiIndex[0]] + multiArray[0][multiIndex[0]] +
multiArray[1][multiIndex[1]] + multiArray[1][multiIndex[1]] +
multiArray[2][multiIndex[2]] multiArray[2][multiIndex[2]]
@ -115,7 +115,7 @@
:maxSize="10 * 1024 * 1024" :maxSize="10 * 1024 * 1024"
@oversize="oversize" @oversize="oversize"
> >
<view class="custom-upload-btn"> <view class="custom-upload-btn" @click.stop="chooseMedia">
<view class="icon-box"> <view class="icon-box">
<image <image
class="camera-icon" class="camera-icon"
@ -159,7 +159,7 @@ export default {
houseOptions: [], houseOptions: [],
currentHouse: {}, currentHouse: {},
multiArray: [[], [], []], multiArray: [[], [], []],
multiIndex: [0, 0, 0], multiIndex: [-1, -1, -1],
form: { form: {
apartmentId: "", apartmentId: "",
apartmentName: "", apartmentName: "",
@ -174,17 +174,18 @@ export default {
watch: { watch: {
"form.apartmentId": { "form.apartmentId": {
handler(newVal, oldVal) { handler(newVal, oldVal) {
console.log("newVal", newVal); if (newVal !== oldVal) {
this.form.buildingId = null; this.form.buildingId = null;
this.form.unitId = null; this.form.unitId = null;
this.form.houseId = null; this.form.houseId = null;
this.buildingOptions = []; this.buildingOptions = [];
this.unitOptions = []; this.unitOptions = [];
this.houseOptions = []; this.houseOptions = [];
}
}, },
deep: true, deep: true,
immediate: true, immediate: true,
apartmentList:[] apartmentList: [],
}, },
}, },
onLoad() { onLoad() {
@ -208,9 +209,9 @@ export default {
// const deptInfo = this.deptOptions[0].children.filter( // const deptInfo = this.deptOptions[0].children.filter(
// (item) => item.deptName == "" // (item) => item.deptName == ""
// )[0]; // )[0];
const newArr = this.deptOptions.map(item => ({ const newArr = this.deptOptions.map((item) => ({
name: item.deptName, name: item.deptName,
})) }));
// this.deptOptions = newArr // this.deptOptions = newArr
// this.deptOptions = await this.getListByParentId("1", deptInfo.deptId); // this.deptOptions = await this.getListByParentId("1", deptInfo.deptId);
// const array = JSON.parse(JSON.stringify(this.deptOptions)); // const array = JSON.parse(JSON.stringify(this.deptOptions));
@ -222,19 +223,18 @@ export default {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
queryDeptDropdownList({ type, id }).then((res) => { queryDeptDropdownList({ type, id }).then((res) => {
resolve(res.data); resolve(res.data);
console.log(res.data,'res.data'); console.log(res.data, "res.data");
}); });
}); });
}, },
async onPickerChange(e, type) { async onPickerChange(e, type) {
if (type == "乐业社区") { if (type == "乐业社区") {
console.log("e", e); console.log("e", e);
const apartmentInfo = this.deptOptions[e.detail.value]; const apartmentInfo = this.deptOptions[e.detail.value];
console.log('社区信息',apartmentInfo); console.log("社区信息", apartmentInfo);
console.log('社区信息11',this.deptOptions); console.log("社区信息11", this.deptOptions);
this.form.apartmentName = apartmentInfo.deptName; this.form.apartmentName = apartmentInfo.deptName;
this.form.apartmentId = apartmentInfo.deptId; this.form.apartmentId = apartmentInfo.deptId;
// //
@ -243,10 +243,10 @@ export default {
apartmentInfo.deptId apartmentInfo.deptId
); );
this.buildingOptions = buildingArray; this.buildingOptions = buildingArray;
console.log('楼信息',buildingArray); console.log("楼信息", buildingArray);
const buildingNames = buildingArray.map((item) => item.name); const buildingNames = buildingArray.map((item) => item.name);
console.log("buildingNames:", buildingNames); console.log("buildingNames:", buildingNames);
this.form.buildingId = buildingArray[0].id; this.form.buildingId = buildingArray[0].id;
// //
const unitArray = await this.getListByParentId( const unitArray = await this.getListByParentId(
@ -255,7 +255,7 @@ export default {
); );
this.unitOptions = unitArray; this.unitOptions = unitArray;
console.log("unitArray:", unitArray); console.log("unitArray:", unitArray);
const unitNames = unitArray.map((item) => item.name); const unitNames = unitArray.map((item) => item.name);
this.form.unitId = unitArray[0].id; this.form.unitId = unitArray[0].id;
// //
@ -369,6 +369,41 @@ export default {
// this.form.waterMeters[index].fileList.splice(event.index, 1); // this.form.waterMeters[index].fileList.splice(event.index, 1);
// this.form.waterMeters[index].imageList.splice(event.index, 1); // this.form.waterMeters[index].imageList.splice(event.index, 1);
}, },
chooseMedia() {
uni.chooseMedia({
count: 10 - this.fileList.length,
mediaType: ["image", "video"],
sourceType: ["album", "camera"],
maxDuration: 60,
camera: "back",
success: async (res) => {
uni.showLoading({ title: "上传中...", mask: true });
try {
const files = res.tempFiles;
for (let i = 0; i < files.length; i++) {
const file = files[i];
const filePath = file.tempFilePath;
const type = file.fileType || (filePath.match(/\.(mp4|mov|avi|wmv|flv|mkv)$/i) ? "video" : "image");
//
const uploadRes = await uploadImage(filePath);
this.fileList.push({
url: uploadRes.data?.url || uploadRes.url || uploadRes.path,
name: uploadRes.data?.name || uploadRes.name || "",
type: type,
status: "success",
});
}
} catch (e) {
uni.showToast({ title: "上传失败", icon: "none" });
} finally {
uni.hideLoading();
}
},
fail: () => {
uni.hideLoading();
},
});
},
// //
async getLastMeter(item) { async getLastMeter(item) {
const params = { const params = {

Loading…
Cancel
Save