修改地块

This commit is contained in:
jsy_zjg 2024-11-22 18:24:42 +08:00
parent bda28779b9
commit 90856e58f6
2 changed files with 131 additions and 411 deletions

View File

@ -9,16 +9,6 @@
<u-tag :text="item.status == 0 ? '启用' : '禁用'" :type="item.status == 0 ? 'success' : 'error'"
size="mini" plain plainFill></u-tag>
</view>
<view class="flex">
<view class="flex" style="margin-right: 15px" v-hasPermi="['land:land:edit']">
<u-icon name="../../../static/images/work/user/user-index-edit-icon.png"></u-icon>
<view style="font-size: 12px; color: #009933; margin-left: 5px" @click="onEditClick">编辑</view>
</view>
<!-- <view class="flex" v-hasPermi="['land:land:remove']">
<u-icon name="../../../static/images/work/user/user-index-del-icon.png"></u-icon>
<view style="font-size: 12px; color: #009933; margin-left: 5px" @click="onDelClick">删除</view>
</view> -->
</view>
</view>
<view class="info-item">
<view class="flex item">
@ -31,7 +21,7 @@
</view>
<view class="flex item">
<view style="color: #939393">地块面积</view>
<view>{{ item.landIcon != null ? item.landIcon : "" }}</view>
<view>{{ item.landArea != null ? item.landArea : "" }}</view>
</view>
<view class="flex item">
<view style="color: #939393">土壤类型</view>
@ -43,33 +33,40 @@
</view>
<view class="flex item">
<view style="color: #939393">是否分组</view>
<view v-if="item.landGroupFlag === 0"></view>
<view v-if="item.landGroupFlag === 1"></view>
<view v-if="item.landConfig.enableGroup === 0"></view>
<view v-if="item.landConfig.enableGroup === 1"></view>
</view>
<view class="flex item">
<view style="color: #939393">启用蝶阀</view>
<view v-if="item.enableFlapValve === 0">启用</view>
<view v-if="item.enableFlapValve === 1">禁用</view>
<view v-if="item.landConfig.enableButterflyValve === 0">启用</view>
<view v-if="item.landConfig.enableButterflyValve === 1">禁用</view>
</view>
<view class="flex item">
<view style="color: #939393">启用批量控制</view>
<view v-if="item.landManualOperation === 0"></view>
<view v-if="item.landManualOperation === 1"></view>
<view v-if="item.landConfig.enableBatchControl === 0"></view>
<view v-if="item.landConfig.enableBatchControl === 1"></view>
</view>
<view class="flex item">
<view style="color: #939393">启用自动刷新</view>
<view v-if="item.landConfig.enableAutoRefresh === 0"></view>
<view v-if="item.landConfig.enableAutoRefresh === 1"></view>
</view>
<view class="flex item">
<view style="color: #939393">所属公司</view>
<view>{{ item.companyName }}</view>
<view v-if="item.companyGroup && item.companyGroup.companyFullName">
{{item.companyGroup.companyFullName}}
</view>
</view>
</view>
</view>
<view class="charge">
<view class="flex item charge-item">
<view style="color: #939393">负责人</view>
<view>{{ item.userName }}</view>
<view>{{ item.user.userName }}</view>
</view>
<view class="flex item charge-item">
<view style="color: #939393">手机号码</view>
<view>{{ item.mobilePhone }}</view>
<view v-if="item.user && item.user.mobilePhone">{{ item.user.mobilePhone }}</view>
</view>
<view class="call">
<u--text text="打电话" color="#009933" iconStyle="margin-right:5px"
@ -77,392 +74,123 @@
@click="onClickPhone(item.mobilePhone)"></u--text>
</view>
</view>
<!-- <view class="buttons">
<u-transition mode="fade-up" :show="showMoreButtons">
<view class="row1">
<view v-hasPermi="['land:valve:position']" @click="onLocationClick">
<u--image src="../../../static/images/work/ground/index/10 (1).png" width="40px"
height="40px"></u--image>
<view class="font">定点</view>
</view>
<view v-hasPermi="['land:valve:list']" @click="onSleepClick(item)">
<u--image src="../../../static/images/work/ground/index/sleep.png" width="40px"
height="40px"></u--image>
<view class="font">休眠</view>
</view>
<view v-hasPermi="['land:valve:batchunbinding']" @click="onUnBindingClick">
<u--image src="../../../static/images/work/ground/index/10 (2).png" width="40px"
height="40px"></u--image>
<view class="font">解绑</view>
</view>
<view v-hasPermi="['irrigate:task']" @click="onUnTaskClick(item.id, item.landName)">
<u--image src="../../../static/images/work/ground/index/task.png" width="40px"
height="40px"></u--image>
<view class="font">任务</view>
</view>
</view>
</u-transition>
<view class="row2">
<view v-hasPermi="['land:manager:list']" @click="onManageClick(item.id)">
<u--image src="../../../static/images/work/ground/index/10 (3).png" width="40px"
height="40px"></u--image>
<view class="font">管理人员</view>
</view>
<view v-hasPermi="['land:station:list']" @click="onBaseClick(item.id, item.landNum)">
<u--image src="../../../static/images/work/ground/index/10 (5).png" width="40px"
height="40px"></u--image>
<view class="font">基站</view>
</view>
<view v-hasPermi="['land:waterOutlet:list']"
@click="onOutClick(item.id, item.landGroupFlag, item.enableFlapValve)">
<u--image src="../../../static/images/work/ground/index/10 (6).png" width="40px"
height="40px"></u--image>
<view class="font">出水口</view>
</view>
<view v-hasPermi="['land:valve:list']" @click="onValveClick(item.id, item.landNum)">
<u--image src="../../../static/images/work/ground/index/10 (4).png" width="40px"
height="40px"></u--image>
<view class="font">阀门</view>
</view>
<view @click="onLoadMoreButton">
<u--image src="../../../static/images/work/ground/index/down.png" width="40px" height="40px"
v-show="showMoreButtons == true"></u--image>
<u--image src="../../../static/images/work/ground/index/up.png" width="40px" height="40px"
v-show="showMoreButtons == false"></u--image>
<view class="font">更多</view>
</view>
</view>
</view> -->
<u-action-sheet :show="showValveActions" :actions="addValveOptions" @close="showValveActions = false"
@select="onValveActionSelect" />
<u-modal :title="scanAddStationDevice ? '确认阀门' : '手动添加'" :show="showModal" showCancelButton buttonReverse
height="300px" @confirm="confirmBindingValve" @cancel="() => (showModal = false)">
<view class="slot-content">
<u--form labelPosition="left" :model="bingdingData" :rules="rules" ref="form">
<u-form-item label="编码" prop="privateSeal" labelWidth="100px" required>
<u--input v-model="bingdingData.privateSeal" placeholder="请输入设备编号"></u--input>
</u-form-item>
<u-form-item label="定点" prop="location" labelWidth="100px">
<u-button :loading="locationLoading" @click="onSetPositionClick" type="success"
:text="locationText" style="margin: 10px 10px"></u-button>
</u-form-item>
</u--form>
<view v-if="scanAddStationDevice">确认添加编码为:{{ scanCode }}的阀门吗?</view>
</view>
</u-modal>
</view>
</template>
<script setup>
import {
onShow,
onLoad,
onReady
} from "@dcloudio/uni-app"
import {
ref
} from "vue"
<script>
import plugin from "@/plugins"
import store from "@/store"
const windowHeight = ref(uni.getSystemInfoSync().windowHeight)
const showValveActions = ref(false)
const addValveOptions = ref([{
name: "扫一扫",
id: 1
},
{
name: "手动输入编码",
id: 2
}
])
const scanAddStationDevice = ref(false)
const showModal = ref(false)
const bingdingData = ref({
privateSeal: "",
longitude: 0,
latitude: 0
})
const rules = ref({
privateSeal: {
type: "string",
required: true,
message: "请填写编码",
trigger: ["blur", "change"]
},
location: {
type: "string",
required: false,
message: "请选择定位",
trigger: ["change"]
}
})
const item = ref({})
const locationText = ref("定点")
const location = ref({})
const locationLoading = ref(false)
const form = ref(null)
const showMoreButtons = ref(false)
//
const sms = ref(null)
//
const info = ref({
phoneNumber: undefined,
taskId: undefined,
show: false
})
//
onLoad(data => {
item.value = JSON.parse(decodeURIComponent(data.item))
getDictList("custom_soil_type")
getDictList("custom_water_source_type")
})
//
onShow(data => {
getLandInfo();
})
const soilType = ref([])
const waterSourceType = ref([])
//
async function getDictList(type) {
store
.dispatch("getDictList", type)
.then(res => {
// console.error("res:", res);
const obj = res.data.reduce((accumulator, current) => {
accumulator[current.dictValue] = current;
return accumulator;
}, {});
if (type == "custom_soil_type") {
soilType.value = obj
}
if (type == "custom_water_source_type") {
waterSourceType.value = obj
}
if (soilType.value.length && waterSourceType.value.length) {
getLandInfo();
}
})
.catch(error => {
plugin.modal.msgError(error)
})
.finally(() => {
plugin.modal.closeLoading()
})
}
//name
function getDictName(type, value) {
const that = this;
let text = "";
if (value) {
if (type == 1) {
text = soilType.value[String(type)].dictLabel
}
if (type == 2) {
value = value.split(',');
value.forEach(item => {
if (text == "") {
text = waterSourceType.value[String(item)].dictLabel
} else {
text = text + "," + waterSourceType.value[String(item)].dictLabel;
}
});
}
}
return text;
}
//
function getLandInfo() {
store
.dispatch("getLandInfo", item.value.id)
.then(res => {
if (res.data != null) {
// console.error("res:", res.data);
item.value = res.data;
//list.value = res.data
}
})
.catch(error => {
plugin.modal.msgError(error)
})
.finally(() => {
plugin.modal.closeLoading()
})
}
function onEditClick() {
plugin.tab.navigateTo("/pages/work/ground/create-new?item=" + encodeURIComponent(JSON.stringify(item.value)))
}
function onDelClick() {
plugin.modal.confirm("确定删除该地块吗?").then(() => {
store
.dispatch("onDeleteGround", item.value.id)
.then(res => {
plugin.modal.msgSuccess("删除成功!")
plugin.tab.navigateBack()
})
.catch(error => {
plugin.modal.msgError(error)
})
})
}
function onOutClick(id, landGroupFlag, enableFlapValve) {
plugin.tab.navigateTo(
`/pages/work/ground/out-water/index?landId=${id}&groupFlag=${landGroupFlag}&enableFlapValve=${enableFlapValve}`
)
}
function onBaseClick(id, num) {
plugin.tab.navigateTo(`/pages/work/ground/stationDevice/index?landId=${id}&landNum=${num}`)
}
function onValveClick(id, num) {
plugin.tab.navigateTo(`/pages/work/ground/valve/index?landId=${id}&landNum=${num}`)
}
function onManageClick(id) {
plugin.tab.navigateTo(`/pages/work/ground/manager/index?landId=${id}&companyId=${item.value.companyId}`)
}
function onUnTaskClick(id, name) {
plugin.tab.navigateTo(`/pages/work/ground/task/index?landId=${id}&landName=${name}`)
}
//
function onLocationClick() {
showValveActions.value = true
}
//
function onValveActionSelect(action) {
if (action.id == 1) {
//
//
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
mpaasScanModule.mpaasScan({
// qrCodebarCode
'scanType': ['qrCode', 'barCode'],
// false
'hideAlbum': false
export default {
data() {
return {
windowHeight: null,
item: {},
soilType: [],
waterSourceType: [],
paging: null,
form: null,
treeList: [],
query: {
companyId: null,
landName: null
},
(ret) => {
if (ret.resp_code == 1000) {
bingdingData.value.privateSeal = ret.resp_result
showModal.value = true
}
})
} else {
//
showModal.value = true
}
}
//
function confirmBindingValve() {
if (locationLoading.value) {
plugin.modal.msgError("获取位置中请勿提交!")
return
}
if (JSON.stringify(location.value) == "{}") {
plugin.modal.msgError("获取位置失败请重新获取!")
return
}
form.value.validate().then(res => {
showModal.value = false
//
let param = {
privateSeal: bingdingData.value.privateSeal,
longitude: location.value.longitude,
latitude: location.value.latitude
selectCompanyObj: {}
}
store
.dispatch("onSetValvePosition", param)
.then(res => {
plugin.modal.msgSuccess("修改成功!")
})
.catch(error => {
plugin.modal.msgError(error)
})
})
}
//
function onSetPositionClick() {
}
//
function onLoadMoreButton() {
showMoreButtons.value = !showMoreButtons.value
}
//
function onClickPhone(phone) {
plugin.modal.confirm("是否拨打电话?").then(res => {
//#ifdef APP-PLUS
plus.device.dial(phone, true)
//#endif
//#ifdef MP-WEIXIN
uni.makePhoneCall({
phoneNumber: phone,
fail: res => {
console.log(res)
},
success: res => {
console.log("success" + res)
}
})
//#endif
})
}
//
function onSleepClick(item) {
plugin.modal.confirm("是否休眠所有阀门?").then(res => {
store
.dispatch("sleepValves", item)
.then(res => {
plugin.modal.msgSuccess("发送成功!")
})
.catch(error => {
plugin.modal.msgError(error)
})
})
}
//
function onUnBindingClick() {
uni.showModal({
title: "提示",
content: `确定解除绑定地块所有阀门吗?`,
// cancelText:"",
// confirmText: "",
success(res) {
if (res.confirm) {
info.value = {
phoneNumber: item.value.mobilePhone,
taskId: item.value.id,
show: true
},
created() {
this.windowHeight = uni.getSystemInfoSync().windowHeight;
},
onLoad(options) {
this.item = JSON.parse(decodeURIComponent(options.item));
console.log(this.item)
this.getDictList("custom_soil_type");
this.getDictList("custom_water_source_type");
this.getLandInfo();
},
methods: {
getDictList(type) {
store
.dispatch("getDictList", type)
.then(res => {
const obj = res.data.reduce((accumulator, current) => {
accumulator[current.dictValue] = current;
return accumulator;
}, {});
if (type == "custom_soil_type") {
this.soilType = obj
}
if (type == "custom_water_source_type") {
this.waterSourceType = obj
}
})
.catch(error => {
plugin.modal.msgError(error)
})
.finally(() => {
plugin.modal.closeLoading()
})
},
getLandInfo() {
store
.dispatch("getLandInfo", this.item.id)
.then(res => {
if (res.data != null) {
this.item = res.data;
}
})
.catch(error => {
plugin.modal.msgError(error)
})
.finally(() => {
plugin.modal.closeLoading()
})
},
getDictName(type, value) {
const that = this;
let text = "";
if (value) {
if (type == 1) {
if (that.soilType[String(type)] && that.soilType[String(type)].dictLabel) {
text = that.soilType[String(type)].dictLabel
}
}
if (type == 2) {
value = value.split(',');
value.forEach(item => {
if (text == "") {
if (that.waterSourceType[String(item)] && that.waterSourceType[String(item)]
.dictLabel) {
text = that.waterSourceType[String(item)].dictLabel
}
} else {
if (that.waterSourceType[String(item)] && that.waterSourceType[String(item)]
.dictLabel) {
text = text + "," + that.waterSourceType[String(item)].dictLabel;
}
}
});
}
sms.value.open();
}
return text;
},
onClickPhone(phone) {
plugin.modal.confirm("是否拨打电话?").then(res => {
//#ifdef APP-PLUS
plus.device.dial(phone, true)
//#endif
//#ifdef MP-WEIXIN
uni.makePhoneCall({
phoneNumber: phone,
fail: res => {
console.log(res)
},
success: res => {
console.log("success" + res)
}
})
//#endif
})
}
})
// plugin.modal.confirm("?").then(() => {})
}
function missionAbort(data) {
store
.dispatch("onUnBindingAllValve", {
id: data.taskId,
code: data.code,
uuid: data.uuid,
})
.then(res => {
sms.value.cancel();
plugin.modal.msgSuccess("解绑成功!")
})
.catch(error => {
sms.value.cancel();
plugin.modal.msgError(error)
})
}
}
</script>
@ -470,35 +198,29 @@
.item-container {
background: #f3f3f3;
}
.flex {
display: flex;
align-items: center;
}
.item {
margin-bottom: 5px;
}
.info {
background: white;
margin: 10px 10px;
padding: 10px;
border-radius: 10px;
box-shadow: 1px 1px 2px 2px rgba(0, 0, 0, 0.05);
.title {
display: flex;
align-items: center;
justify-content: space-between;
margin: 10px 10px;
}
.info-item {
margin-left: 20px;
}
}
.charge {
background: white;
margin: 10px 10px;
@ -506,11 +228,9 @@
border-radius: 10px;
box-shadow: 1px 1px 2px 2px rgba(0, 0, 0, 0.05);
position: relative;
.charge-item {
margin-left: 20px;
}
.call {
position: absolute;
top: 20px;
@ -529,13 +249,11 @@
bottom: 0%;
transition: all 0.1s;
box-sizing: border-box;
.row1 {
margin-bottom: 20px;
width: 100%;
display: flex;
align-items: center;
&>view {
width: 25%;
white-space: nowrap;
@ -546,12 +264,10 @@
align-items: center;
}
}
.row2 {
width: 100%;
display: flex;
align-items: center;
&>view {
width: 25%;
white-space: nowrap;
@ -563,7 +279,6 @@
}
}
}
.font {
margin-top: 5px;
font-size: 12px;

View File

@ -30,7 +30,7 @@
</view>
</view>
<u-gap height="1" bgColor="#D2D2D2"></u-gap>
<view style="display: flex;justify-content: space-between;align-items: center;">
<view style="display: flex;justify-content: space-between;align-items: center;" @click="onItemClick(item)">
<view class="data">
<view class="flex-text global-font-size-1">
<view class="flex-text-one">地块名称</view>
@ -54,6 +54,11 @@
{{item.companyGroup.companyFullName}}</view>
</view>
</view>
<view>
<view v-hasPermi="['land:land:query']" style="margin-right: 10px;">
<u-icon name="arrow-right"></u-icon>
</view>
</view>
</view>
</view>
</template>