jsy-app/pages/irrigation/index.vue

303 lines
9.2 KiB
Vue
Raw Normal View History

2024-09-30 15:52:11 +08:00
<template>
2025-01-09 18:29:36 +08:00
<!-- 顶部导航栏 -->
<custom-nav-bar :left="false" leftText="" @leftClick="" title="轮灌">
<template v-slot:right>
<view class="fixed">
2025-01-23 11:02:58 +08:00
<view align="right" class="iconfont icon-jia1 icon" @click="editTask()" v-show="tab.current === 0" />
<view align="right" class="iconfont icon-jia1 icon" @click="editScenario()" v-show="tab.current === 1"
v-hasPermi="['irrigate:irrigateScenario:saveIrrigateScenario']" />
2025-01-09 18:29:36 +08:00
</view>
</template>
</custom-nav-bar>
<!-- 选项卡 -->
2025-01-22 23:45:15 +08:00
<uni-segmented-control :current="tab.current" :values="tab.items" @clickItem="onClickItem" styleType="text"
2025-01-09 18:29:36 +08:00
activeColor="#39ac4f"></uni-segmented-control>
2025-01-22 23:45:15 +08:00
2025-01-09 18:29:36 +08:00
<view class="content">
2025-01-22 23:45:15 +08:00
<view v-show="tab.current === 0">
<z-paging ref="pagingTask" @query="queryTask" v-model="task" :auto-show-system-loading="true"
:default-page-size="pageSize" empty-view-text="抱歉,暂时还没有相关数据!" class="custom-z-paging">
<view class="card">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false" :show-arrow="false" :open="true">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">任务名称006</view>
2025-01-09 18:29:36 +08:00
</view>
2025-01-22 23:45:15 +08:00
<view class="title-r">
<uni-tag class="bg-green" :circle="true" text="轮灌中" />
2025-01-09 18:29:36 +08:00
</view>
</view>
2025-01-22 23:45:15 +08:00
</template>
<view class="content">
<view class="cards-content">
<view class="txt-list" @click="taskdetails">
<view class="list1">
<view><text>轮灌方案</text>全设备</view>
<view><text>起始值</text>外部程曦</view>
<view><text>开始时间</text>2025-01-05&nbsp;&nbsp;10:11</view>
<view><text>结束时间</text>2025-01-05&nbsp;&nbsp;10:11</view>
<view><text>是否调压</text></view>
</view>
<view class="right">
<view class="iconfont icon-you">
</view>
2025-01-09 18:29:36 +08:00
</view>
</view>
</view>
</view>
2025-01-22 23:45:15 +08:00
</uni-collapse-item>
</uni-collapse>
</view>
<view class="card">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false" :show-arrow="false">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">任务名称006</view>
</view>
<view class="title-r">
<uni-tag class="bg-orange" :circle="true" text="暂停" />
</view>
2025-01-09 18:29:36 +08:00
</view>
2025-01-22 23:45:15 +08:00
</template>
<view class="content">
<view class="cards-content">
<view class="txt-list">
<view class="list1">
<view><text>轮灌方案</text>全设备</view>
<view><text>起始值</text>外部程曦</view>
<view><text>开始时间</text>2025-01-05&nbsp;&nbsp;10:11</view>
<view><text>结束时间</text>2025-01-05&nbsp;&nbsp;10:11</view>
<view><text>是否调压</text></view>
</view>
<view class="right">
<view class="iconfont icon-you">
</view>
</view>
</view>
2025-01-09 18:29:36 +08:00
</view>
</view>
2025-01-22 23:45:15 +08:00
</uni-collapse-item>
</uni-collapse>
</view>
<view class="card">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false" :show-arrow="false">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">任务名称006</view>
</view>
<view class="title-r">
<uni-tag class="bg-red" :circle="true" text="终止" />
2025-01-09 18:29:36 +08:00
</view>
2025-01-22 23:45:15 +08:00
</view>
</template>
<view class="content">
<view class="cards-content">
<view class="txt-list">
<view class="list1">
<view><text>轮灌方案</text>全设备</view>
<view><text>起始组</text>外部程曦</view>
<view><text>开始时间</text>2025-01-05&nbsp;&nbsp;10:11</view>
<view><text>结束时间</text>2025-01-05&nbsp;&nbsp;10:11</view>
<view><text>是否调压</text></view>
</view>
<view class="right">
<view class="iconfont icon-you">
</view>
2025-01-09 18:29:36 +08:00
</view>
</view>
</view>
</view>
2025-01-22 23:45:15 +08:00
</uni-collapse-item>
</uni-collapse>
</view>
</z-paging>
2025-01-09 18:29:36 +08:00
</view>
2025-01-22 23:45:15 +08:00
<view v-show="tab.current === 1">
<z-paging ref="pagingScenario" @query="queryScenario" v-model="scenario" :auto-show-system-loading="true"
:default-page-size="pageSize" empty-view-text="抱歉,暂时还没有相关数据!" class="custom-z-paging">
<view class="card">
<uni-collapse>
<uni-collapse-item title-border="none" :border="false" :show-arrow="false" :open="true"
v-for="item in scenario">
<template v-slot:title>
<view class="cards-title">
<view>
<view class="text">方案名称{{item.scenarioName}}</view>
2025-01-09 18:29:36 +08:00
</view>
2025-01-23 11:02:58 +08:00
<view class="title-r">
<uni-tag class="bg-green" :circle="true" text="启用" v-if="item.delFlag == '0'" />
<uni-tag class="bg-red" :circle="true" text="禁用" v-else />
</view>
2025-01-22 23:45:15 +08:00
</view>
</template>
<view class="content">
<view class="cards-content">
<view class="txt-list" @click="irrigationgroup(item)">
<view class="list2">
<view><text>轮灌组数量</text>{{item.groupNum}}</view>
<view><text>总时长</text>{{item.irrigateTotalDuration}}</view>
2025-01-23 11:02:58 +08:00
<view><text>自动调压</text>{{item.isAutoAdjust == 0 ? '否':'是'}}</view>
<view><text>压力</text>{{`${item.pressureMin} - ${item.pressureMax}`}}</view>
2025-01-22 23:45:15 +08:00
</view>
<view class="right">
2025-01-23 11:02:58 +08:00
<view class="iconfont icon-you" />
2025-01-09 18:29:36 +08:00
</view>
</view>
2025-01-22 23:45:15 +08:00
<view class="card-font">
2025-01-23 11:02:58 +08:00
<u-button v-hasPermi="['irrigate:irrigateScenario:saveIrrigateScenario']"
type="success" size="mini" text="编辑" @click="editScenario(item)" />
<u-button v-hasPermi="['irrigate:irrigateScenario:delFlag']" size="mini"
type="error" text="禁用" @click="updateScenario(item,true)"
v-if="item.delFlag == '0'" />
<u-button v-hasPermi="['irrigate:irrigateScenario:delFlag']" size="mini"
type="success" text="启用" @click="updateScenario(item,false)" v-else />
2025-01-22 23:45:15 +08:00
</view>
2025-01-09 18:29:36 +08:00
</view>
</view>
2025-01-22 23:45:15 +08:00
</uni-collapse-item>
</uni-collapse>
</view>
</z-paging>
2025-01-09 18:29:36 +08:00
</view>
</view>
2024-09-30 15:52:11 +08:00
</template>
<script>
2025-01-22 09:34:51 +08:00
import * as isApi from '@/api/irrigate/irrigateScenario.js'
2025-01-09 18:29:36 +08:00
export default {
data() {
return {
2025-01-22 23:45:15 +08:00
tab: {
items: ['轮灌详情', '轮灌方案'],
current: 0,
},
2025-01-23 15:17:08 +08:00
landId: null,
2025-01-22 23:45:15 +08:00
pageSize: 20,
2025-01-23 15:17:08 +08:00
landId: null,
2025-01-22 23:45:15 +08:00
task: [],
scenario: [],
2025-01-09 18:29:36 +08:00
};
},
2025-01-23 15:17:08 +08:00
onShow() {
if (getApp().ijs.land) {
this.landId = getApp().ijs.land.id;
}
},
2025-01-22 09:34:51 +08:00
mounted() {},
2025-01-09 18:29:36 +08:00
methods: {
2025-01-22 23:45:15 +08:00
onClickItem(e) {
if (this.tab.current != e.currentIndex) {
this.tab.current = e.currentIndex;
2025-01-22 09:34:51 +08:00
}
},
2025-01-22 23:45:15 +08:00
async queryTask() {
this.$refs.pagingTask.completeByTotal([]);
// this.$refs.pagingTask.completeByTotal(res.rows, res.total);
},
async queryScenario() {
isApi.list({
2025-01-23 15:17:08 +08:00
landId: this.landId,
2025-01-22 23:45:15 +08:00
scenarioType: 2,
status: "0",
2025-01-23 11:02:58 +08:00
// delFlag: "0",
2025-01-22 23:45:15 +08:00
}).then(res => {
this.scenario = res.rows;
this.$refs.pagingScenario.completeByTotal(res.rows, res.total);
})
},
2025-01-23 11:02:58 +08:00
/********************************* 任务 *********************************/
editTask(item = null) {
2025-01-23 15:17:08 +08:00
let url = `/pages/irrigation/task/task`
if (item) {
url = `${url}?id=${item.id}`
} else {
url = `${url}?landId=${this.landId}`
}
uni.navigateTo({
url: url
});
2025-01-09 18:29:36 +08:00
},
2025-01-22 23:45:15 +08:00
//页面跳转
2025-01-09 18:29:36 +08:00
taskdetails() {
uni.navigateTo({
url: '/pages/irrigation/details/taskdetails'
});
2025-01-13 12:18:59 +08:00
},
2025-01-22 23:45:15 +08:00
/********************************* 方案 *********************************/
2025-01-23 11:02:58 +08:00
//方案编辑
editScenario(item = null) {
let url = `/pages/irrigation/scenario/scenario`
if (item) {
url = `${url}?id=${item.id}`
2025-01-23 15:17:08 +08:00
} else {
url = `${url}?landId=${this.landId}`
2025-01-23 11:02:58 +08:00
}
2025-01-13 12:18:59 +08:00
uni.navigateTo({
2025-01-23 11:02:58 +08:00
url: url
2025-01-22 23:45:15 +08:00
});
},
2025-01-23 11:02:58 +08:00
//方案详情
irrigationgroup(item) {
2025-01-22 23:45:15 +08:00
uni.navigateTo({
2025-01-23 11:02:58 +08:00
url: `/pages/irrigation/scenario/detail?id=${item.id}`
2025-01-13 12:18:59 +08:00
});
},
2025-01-23 11:02:58 +08:00
//方案删除
updateScenario(item, disabled) {
if (disabled) {
this.$showConfirm(`禁用"${item.scenarioName}"?`).then(() => {
isApi.disabled(item.id).then(res => {
this.$toast("禁用成功");
this.queryScenario();
})
}).catch(() => {});
} else {
this.$showConfirm(`启用"${item.scenarioName}"?`).then(() => {
2025-01-23 11:32:16 +08:00
isApi.enable(item.id).then(res => {
2025-01-23 11:02:58 +08:00
this.$toast("启用成功");
this.queryScenario();
})
}).catch(() => {});
}
}
2025-01-22 09:34:51 +08:00
2025-01-22 23:45:15 +08:00
// // 页面跳转
// config() {
// uni.navigateTo({
// url: '/pages/irrigation/config'
// });
// }
2025-01-09 18:29:36 +08:00
},
};
2024-09-30 15:52:11 +08:00
</script>
2025-01-09 18:29:36 +08:00
<style lang="scss" scoped>
// 选项卡
.segmented-control {
background-color: #fff;
}
.segmented-control__item--text {
font-weight: bold;
}
::v-deep .segmented-control__text {
font-size: 16px;
}
2025-01-22 23:45:15 +08:00
.custom-z-paging {
margin-top: 80px;
}
2024-09-30 15:52:11 +08:00
</style>