.
This commit is contained in:
parent
9b642d8d21
commit
3231706250
@ -59,15 +59,8 @@ export function saveBatchControlAngle(groupId) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 查询轮灌-轮灌方案 列表
|
||||
export function listIrrigateScenario(query) {
|
||||
export function list(query) {
|
||||
return request({
|
||||
url: '/irrigate/irrigateScenario/list',
|
||||
method: 'get',
|
||||
@ -75,6 +68,13 @@ export function listIrrigateScenario(query) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 查询轮灌-轮灌方案 详细
|
||||
export function getIrrigateScenario(id) {
|
||||
return request({
|
||||
|
100
pages.json
100
pages.json
@ -28,48 +28,6 @@
|
||||
"navigationBarTitleText": "轮灌",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/add/scheme",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌方案",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/add/addtask",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌任务",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/details/taskdetails",
|
||||
"style": {
|
||||
"navigationBarTitleText": "任务详情",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/details/irrigationdetails",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌详情",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/irrigationgroup",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌组列表",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/config",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌组配置",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/rotationrecord",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌履历",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/head/index",
|
||||
"style": {
|
||||
@ -317,6 +275,64 @@
|
||||
"navigationBarTitleText": "批量控制编辑",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
/******************************* 轮灌 ******************************/
|
||||
{
|
||||
"path": "pages/irrigation/scenario/scenario",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌方案",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/scenario/scenarioGroup",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌方案",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "pages/irrigation/add/scheme",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌方案",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/add/addtask",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌任务",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/details/taskdetails",
|
||||
"style": {
|
||||
"navigationBarTitleText": "任务详情",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/details/irrigationdetails",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌详情",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/irrigationgroup",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌组列表",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/config",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌组配置",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/irrigation/rotationrecord",
|
||||
"style": {
|
||||
"navigationBarTitleText": "轮灌履历",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
@ -35,8 +35,7 @@
|
||||
<view class="greybar-box" v-for="child in item.children">
|
||||
<view class="title">
|
||||
<view>出水口:<span>{{child.showName}}</span></view>
|
||||
<view v-if="child.deviceRelation">
|
||||
阀门:
|
||||
<view v-if="child.deviceRelation">阀门:
|
||||
<span v-if="[2,3].includes(child.deviceRelation.deviceTypeId)">
|
||||
三通阀
|
||||
</span>
|
||||
@ -47,11 +46,11 @@
|
||||
</view>
|
||||
<view class="check-box" v-if="child.deviceRelation">
|
||||
<uni-forms-item v-if="[2,3].includes(child.deviceRelation.deviceTypeId)">
|
||||
<uni-data-checkbox :multiple="true" :localdata="valve"
|
||||
<uni-data-checkbox mode="tag" :multiple="true" :localdata="valve"
|
||||
:value="select.newV[child.id]" @change="itemChange($event,child)" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-else-if="[13].includes(child.deviceRelation.deviceTypeId)">
|
||||
<uni-data-checkbox :multiple="true" :localdata="fiveValve"
|
||||
<uni-data-checkbox mode="tag" :multiple="true" :localdata="fiveValve"
|
||||
:value="select.newV[child.id]" @change="itemChange($event,child)" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
|
@ -187,17 +187,31 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as isApi from '@/api/irrigate/irrigateScenario.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
items: ['轮灌详情', '轮灌方案'],
|
||||
current: 0
|
||||
};
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.queryList(0);
|
||||
this.queryList(1);
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
async queryList(type) {
|
||||
if (type === 0) { //任务
|
||||
|
||||
}
|
||||
if (type === 1) { //轮灌
|
||||
isApi.list().then(res => {
|
||||
console.error("res:", res);
|
||||
})
|
||||
}
|
||||
},
|
||||
onClickItem(e) {
|
||||
if (this.current != e.currentIndex) {
|
||||
this.current = e.currentIndex;
|
||||
@ -215,9 +229,14 @@
|
||||
});
|
||||
},
|
||||
add() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/irrigation/add/addtask'
|
||||
});
|
||||
if (this.current === 0) { //新增任务
|
||||
|
||||
}
|
||||
if (this.current === 1) { //新增轮灌
|
||||
uni.navigateTo({
|
||||
url: '/pages/irrigation/scenario/scenario'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
118
pages/irrigation/scenario/scenario.vue
Normal file
118
pages/irrigation/scenario/scenario.vue
Normal file
@ -0,0 +1,118 @@
|
||||
<template>
|
||||
<!-- 顶部导航栏 -->
|
||||
<custom-nav-bar :left="true" leftText="" @leftClick="" title="新增方案"></custom-nav-bar>
|
||||
|
||||
<view class="create-container">
|
||||
<u-form ref="form" :model="formData" :rules="rules">
|
||||
<u-form-item label="方案名称" prop="scenarioName" required>
|
||||
<u-input v-model="formData.scenarioName" placeholder="请输入方案名称" />
|
||||
</u-form-item>
|
||||
<u-form-item label="总时长" prop="irrigateTotalDuration" required>
|
||||
<u-input v-model="formData.irrigateTotalDuration" placeholder="请输入总时长" />
|
||||
</u-form-item>
|
||||
<u-form-item label="轮灌组数" prop="groupNum" required>
|
||||
<u-input v-model="formData.groupNum" placeholder="请输入轮灌组数" />
|
||||
</u-form-item>
|
||||
<u-form-item label="自动调压" prop="isAutoAdjust" required>
|
||||
<u-radio-group v-model="formData.isAutoAdjust" color="#39ac4f">
|
||||
<u-radio label="是" name="male"></u-radio>
|
||||
<u-radio label="否" name="female"></u-radio>
|
||||
</u-radio-group>
|
||||
</u-form-item>
|
||||
<u-form-item label="最小压力" prop="pressureMin" required>
|
||||
<u-input v-model="formData.pressureMin" placeholder="请输入最小压力" />
|
||||
</u-form-item>
|
||||
<u-form-item label="最大压力" prop="pressureMax" required>
|
||||
<u-input v-model="formData.pressureMax" placeholder="请输入最大压力" />
|
||||
</u-form-item>
|
||||
<view class="form-btn">
|
||||
<u-button type="success" size="large" text="确定" @click="confirm" />
|
||||
<u-button size="large" text="取消" @click="close" />
|
||||
</view>
|
||||
</u-form>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
landId: null,
|
||||
formData: {
|
||||
landId: '', //地块id
|
||||
scenarioName: '轮灌方案1', //浇灌方案名称
|
||||
irrigateTotalDuration: 12, //浇灌总时长
|
||||
groupNum: 5, //轮灌组数
|
||||
scenarioType: 2, //方案类型(1手动 2自动)
|
||||
isAutoAdjust: 0, //是否自动调压(0否1是)
|
||||
pressureMin: '0', //压力最小值
|
||||
pressureMax: '0', //压力最大值
|
||||
status: '0', //状态(0启用 1禁用)
|
||||
delFlag: '0', //删除状态(0存在 2删除)
|
||||
},
|
||||
rules: {
|
||||
username: [{
|
||||
required: true,
|
||||
message: '请输入任务名称',
|
||||
trigger: ['change', 'blur']
|
||||
}]
|
||||
}
|
||||
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
if (getApp().ijs.land) {
|
||||
this.formData.landId = getApp().ijs.land.id;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openPopup() {
|
||||
this.$refs.groupPopup.open();
|
||||
},
|
||||
closePopup() {
|
||||
this.$refs.groupPopup.close();
|
||||
},
|
||||
close() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
confirm() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/irrigation/scenario/scenarioGroup?item=${JSON.stringify(this.formData)}`
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
body {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
// 表单
|
||||
.create-container {
|
||||
padding: 0 20px;
|
||||
background-color: #FFF;
|
||||
|
||||
// .custom-input {
|
||||
// width: 280px;
|
||||
// }
|
||||
// .form-item {
|
||||
// margin-left: 20px;
|
||||
// display: flex;
|
||||
// align-items: flex-start;
|
||||
// width: 100%;
|
||||
// }
|
||||
::v-deep .u-form-item__body__left {
|
||||
width: 80px !important;
|
||||
}
|
||||
}
|
||||
|
||||
// 弹出框
|
||||
.popup-content {
|
||||
padding: 20px;
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
296
pages/irrigation/scenario/scenarioGroup.vue
Normal file
296
pages/irrigation/scenario/scenarioGroup.vue
Normal file
@ -0,0 +1,296 @@
|
||||
<template>
|
||||
<!-- 顶部导航栏 -->
|
||||
<custom-nav-bar :left="true" leftText="" @leftClick="" :title="formData.scenarioName">
|
||||
<template v-slot:right>
|
||||
<view class="fixed">
|
||||
<view align="right" class="iconfont icon-liebiao icon" @click="groupPop = true"></view>
|
||||
</view>
|
||||
</template>
|
||||
</custom-nav-bar>
|
||||
<view class="text-intel" v-if="formData">
|
||||
<view>
|
||||
<span class="text">
|
||||
{{formData.groups[gIndex].groupName}}
|
||||
</span>
|
||||
</view>
|
||||
<view>
|
||||
<span>
|
||||
时长:{{formData.groups[gIndex].irrigateDuration}}h
|
||||
</span>
|
||||
</view>
|
||||
<view>
|
||||
<!-- <span>已选:{{formData.groups[gIndex].wos.length}}</span> -->
|
||||
<span>已选:{{Object.keys(select.count).length}}</span>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card">
|
||||
<uni-collapse>
|
||||
<uni-collapse-item title-border="none" :border="false" :show-arrow="false" :open="true"
|
||||
v-for="item in woData">
|
||||
<template v-slot:title>
|
||||
<view class="cards-title">
|
||||
<view>
|
||||
<view class="iconfont icon-nongtian icon"></view>
|
||||
<view class="text" style="color: #333;">
|
||||
{{ item.landGroup }}{{ item.branchCanalCode }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<view class="content" v-if="item.children">
|
||||
<uni-forms ref="baseForm">
|
||||
<view class="cards-content">
|
||||
<view class="greybar-box" v-for="child in item.children">
|
||||
<view class="title">
|
||||
<view>出水口:<span>{{child.showName}}</span></view>
|
||||
<view v-if="child.deviceRelation">阀门:
|
||||
<span v-if="[2,3].includes(child.deviceRelation.deviceTypeId)">
|
||||
三通阀
|
||||
</span>
|
||||
<span v-if="[13].includes(child.deviceRelation.deviceTypeId)">
|
||||
五通阀
|
||||
</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="check-box" v-if="child.deviceRelation">
|
||||
<uni-forms-item v-if="[2,3].includes(child.deviceRelation.deviceTypeId)">
|
||||
<uni-data-checkbox mode="tag" :multiple="true" :localdata="valve"
|
||||
:value="select.newV[child.id]" @change="itemChange($event,child)" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-else-if="[13].includes(child.deviceRelation.deviceTypeId)">
|
||||
<uni-data-checkbox mode="tag" :multiple="true" :localdata="fiveValve"
|
||||
:value="select.newV[child.id]" @change="itemChange($event,child)" />
|
||||
</uni-forms-item>
|
||||
<view>
|
||||
<uni-tag text="标签" type="primary" size="mini" />
|
||||
<uni-tag text="标签" type="primary" size="mini" />
|
||||
<uni-tag text="标签" type="primary" size="mini" />
|
||||
<uni-tag text="标签" type="primary" size="mini" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="no-data" v-else>
|
||||
<view class="iconfont icon-wbd"></view>未绑定阀门
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
</view>
|
||||
<view class="bottom-btn">
|
||||
<u-button type="success" size="large" text="下一组" @click="nextGroup"
|
||||
v-if="formData.groups.length > (gIndex+1)" />
|
||||
<u-button type="success" size="large" text="保存" @click="confirm" v-else />
|
||||
</view>
|
||||
|
||||
<!-- 左侧分组弹出层 -->
|
||||
<u-popup mode="left" :show="groupPop" @close="groupPop = false">
|
||||
<view style="width: 90vw;">
|
||||
<view class="card">
|
||||
<uni-collapse>
|
||||
<uni-collapse-item title-border="none" :border="false" :show-arrow="false"
|
||||
v-for="item in formData.groups">
|
||||
<template v-slot:title>
|
||||
<view class="cards-title">
|
||||
<view>
|
||||
<view class="iconfont icon-nongtian icon"></view>
|
||||
<view class="text" style="color: #333;">
|
||||
{{item.groupName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<view class="content">
|
||||
<view class="cards-content" v-if="item.wos.length">
|
||||
<view class="greybar" v-for="wo in item.wos">
|
||||
<view>出水口:<span>1-1</span></view>
|
||||
<view>三通<span>①开</span></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
</view>
|
||||
<view class="bottom-btn">
|
||||
<u-button type="success" size="large" :text="confirmLabel" @click="confirm" />
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import store from '@/store'
|
||||
const user = store.state.user.user;
|
||||
import {
|
||||
getWaterOutletPermissionList
|
||||
} from "@/api/system/landWaterOutletPermission";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
groupPop: false,
|
||||
formData: null,
|
||||
gIndex: 0, //当前编辑的索引
|
||||
woData: [], //出水口列表
|
||||
// 三通阀
|
||||
valve: [{
|
||||
text: '①开',
|
||||
value: 1,
|
||||
key: "open1"
|
||||
},
|
||||
{
|
||||
text: '②开',
|
||||
value: 2,
|
||||
key: "open2"
|
||||
}
|
||||
],
|
||||
// 多通阀
|
||||
fiveValve: [{
|
||||
text: '①开',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: '②开',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
text: '③开',
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
text: '④开',
|
||||
value: 4
|
||||
}
|
||||
],
|
||||
select: {
|
||||
oldV: {},
|
||||
newV: {},
|
||||
count: {},
|
||||
groupV: {},
|
||||
},
|
||||
};
|
||||
},
|
||||
onLoad(par) {
|
||||
console.error(par);
|
||||
this.formData = JSON.parse(par.item);
|
||||
console.error("this.formData:", this.formData);
|
||||
if (this.formData.id) {
|
||||
|
||||
} else {
|
||||
let groupArr = [];
|
||||
const irrigateDuration = (this.formData.irrigateTotalDuration / this.formData.groupNum).toFixed(1);
|
||||
for (var i = 1; i <= this.formData.groupNum; i++) {
|
||||
groupArr.push({
|
||||
id: undefined,
|
||||
title: "新增",
|
||||
landId: this.formData.landId,
|
||||
userId: user.userId,
|
||||
shareUserIds: undefined,
|
||||
irrigateScenarioId: this.formData.id,
|
||||
groupName: `轮灌组${i}`,
|
||||
irrigateDuration: irrigateDuration,
|
||||
sort: i,
|
||||
delFlag: "0",
|
||||
wos: []
|
||||
});
|
||||
}
|
||||
this.formData.groups = groupArr;
|
||||
}
|
||||
console.error("this.formData:", this.formData);
|
||||
},
|
||||
onShow() {},
|
||||
mounted() {
|
||||
uni.showLoading();
|
||||
// 初始化出水口数据
|
||||
getWaterOutletPermissionList(this.formData.landId).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res.data) {
|
||||
this.woData = res.data;
|
||||
} else {
|
||||
this.woData = [];
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 选中数据
|
||||
itemChange(e, item) {
|
||||
const setToRemove = new Set(this.select.oldV[item.id]?.newV || []);
|
||||
const value = e.detail.value.filter(x => !setToRemove.has(x));
|
||||
|
||||
if (this.select.oldV[item.id]) {
|
||||
this.select.oldV[item.id].value = value;
|
||||
// this.select.oldV[item.id].selected = value;
|
||||
} else {
|
||||
this.select.oldV[item.id] = {
|
||||
value: value, //当前选中的
|
||||
newV: [], //所有选中的
|
||||
selected: [], //固定选中的
|
||||
};
|
||||
}
|
||||
const newV = value.concat(this.select.oldV[item.id].selected);
|
||||
this.select.newV[item.id] = newV;
|
||||
this.select.oldV[item.id].newV = newV;
|
||||
|
||||
this.select.count[item.id] = value;
|
||||
|
||||
console.error("select:", this.select);
|
||||
},
|
||||
// 下一组
|
||||
nextGroup() {
|
||||
// 存储当前组的数据
|
||||
let groupV = {};
|
||||
for (var key in this.select.oldV) {
|
||||
const value = this.select.oldV[key].value;
|
||||
if (value.length) {
|
||||
let obj = {};
|
||||
obj[value[0]] = this.gIndex;
|
||||
groupV[key] = obj;
|
||||
|
||||
this.select.oldV[key].selected = value.concat(this.select.oldV[key].selected);
|
||||
}
|
||||
}
|
||||
this.select.groupV = Object.assign(this.select.groupV, groupV);
|
||||
this.select.count = {};
|
||||
this.gIndex++;
|
||||
},
|
||||
// 保存
|
||||
confirm() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
uni-app,
|
||||
uni-page,
|
||||
uni-page-wrapper,
|
||||
uni-page-body {
|
||||
padding-bottom: 38px !important;
|
||||
}
|
||||
|
||||
::v-deep .uni-forms {
|
||||
margin-right: 10px;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
::v-deep .uni-forms-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
::v-deep .uni-forms-item__label {
|
||||
min-width: 0 !important;
|
||||
width: auto !important;
|
||||
font-size: 0.8rem;
|
||||
height: inherit;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::v-deep .uni-easyinput__content-input {
|
||||
height: 20px;
|
||||
width: 50px;
|
||||
padding-left: 5px !important;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user