关联大棚
parent
077ee218b5
commit
b88ebaeeee
|
|
@ -49,3 +49,16 @@ export function delAgri(id) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移动端添加大棚
|
||||||
|
* @param data
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
export function addAgriMobile(data) {
|
||||||
|
return request({
|
||||||
|
url: '/assets/agri/addAgriFromMobile',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -4,18 +4,19 @@
|
||||||
<!-- 新增:修改运行时间的弹窗 -->
|
<!-- 新增:修改运行时间的弹窗 -->
|
||||||
<view class="modal-container">
|
<view class="modal-container">
|
||||||
<view class="modal-title">{{ `添加大棚` }}</view>
|
<view class="modal-title">{{ `添加大棚` }}</view>
|
||||||
<view class="modal-input-wrap" >
|
<uni-forms ref="form" :model="formData" :rules="rules" label-width="180rpx" validateTrigger="blur">
|
||||||
<text class="modal-label">大棚名称:</text>
|
<uni-forms-item label="大棚名称:" name="agriName" required>
|
||||||
<uni-easyinput style="width: 100px" v-model="agriName" placeholder="请输入大棚名称" />
|
<uni-easyinput type="text" v-model="formData.agriName" placeholder="请输入大棚名称" />
|
||||||
</view>
|
</uni-forms-item>
|
||||||
<view class="modal-input-wrap" >
|
<uni-forms-item label="设备imei:" name="imei" required>
|
||||||
<text class="modal-label">设备imei:</text>
|
<uni-easyinput v-model="formData.imei" placeholder="在此输入设备imei号" >
|
||||||
<uni-easyinput style="width: 100px" v-model="imei" placeholder="请输入大棚名称" >
|
|
||||||
<template #right>
|
<template #right>
|
||||||
<yt-scanCode @getScanCode="getScanCode"></yt-scanCode>
|
<yt-scanCode @getScanCode="getScanCode"></yt-scanCode>
|
||||||
</template>
|
</template>
|
||||||
</uni-easyinput>
|
</uni-easyinput>
|
||||||
</view>
|
</uni-forms-item>
|
||||||
|
</uni-forms>
|
||||||
|
|
||||||
<view class="modal-input-wrap" >
|
<view class="modal-input-wrap" >
|
||||||
<text class="modal-label"></text>
|
<text class="modal-label"></text>
|
||||||
<uni-icons type="info" size="15" color="#666"/>
|
<uni-icons type="info" size="15" color="#666"/>
|
||||||
|
|
@ -33,19 +34,51 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import UniPopup from "../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
|
import UniPopup from "../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
|
||||||
|
import {addAgriMobile} from "../../api/system/assets/agri";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "addAgri",
|
name: "addAgri",
|
||||||
components: {UniPopup},
|
components: {UniPopup},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
agriName: null,
|
|
||||||
imei:null,
|
|
||||||
formData: {
|
formData: {
|
||||||
name:null,
|
agriName: null,
|
||||||
email:null
|
imei: null,
|
||||||
|
sourceCode:0
|
||||||
},
|
},
|
||||||
rules:[]
|
rules: {
|
||||||
|
agriName: {
|
||||||
|
rules:[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
errorMessage: '请输入温室名称!',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// 对name字段进行必填验证
|
||||||
|
imei: {
|
||||||
|
// name 字段的校验规则
|
||||||
|
rules:[
|
||||||
|
// 校验 name 不能为空
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
errorMessage: '请输入设备imei!',
|
||||||
|
},
|
||||||
|
// 对name字段进行长度验证
|
||||||
|
{
|
||||||
|
minLength: 15,
|
||||||
|
maxLength: 15,
|
||||||
|
errorMessage: '{label}不合法!需为 {maxLength} 位!',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: /^\d{15}$/, // 核心正则
|
||||||
|
errorMessage: '请输入15位纯数字编号'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 当前表单域的字段中文名,可不填写
|
||||||
|
label:'设备imei'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
|
@ -53,8 +86,23 @@ export default {
|
||||||
this.$refs.addForm.close();
|
this.$refs.addForm.close();
|
||||||
},
|
},
|
||||||
confirm() {
|
confirm() {
|
||||||
|
this.$refs.form.validate().then(res => {
|
||||||
this.close()
|
if (!res) {
|
||||||
|
addAgriMobile(this.formData).then((response) => {
|
||||||
|
if (response.code===200) {
|
||||||
|
uni.showModal({
|
||||||
|
title: `${response.data.code===1?"✅":"⚠️"}操作提示`,
|
||||||
|
content: `${response.data.msg}`,
|
||||||
|
showCancal: false,
|
||||||
|
confirmText: '确定',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.close();
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('表单错误信息:', err);
|
||||||
|
})
|
||||||
},
|
},
|
||||||
open() {
|
open() {
|
||||||
this.$refs.addForm.open();
|
this.$refs.addForm.open();
|
||||||
|
|
@ -65,7 +113,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped >
|
||||||
|
|
||||||
/* 新增:弹窗样式 */
|
/* 新增:弹窗样式 */
|
||||||
.modal-container {
|
.modal-container {
|
||||||
|
|
@ -95,22 +143,7 @@ export default {
|
||||||
width: 140rpx;
|
width: 140rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
.modal-current {
|
|
||||||
margin-left: 14rpx;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
.modal-input {
|
|
||||||
height: 60rpx;
|
|
||||||
border: 1px solid #eee;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
padding: 0 15rpx;
|
|
||||||
font-size: 20rpx !important;
|
|
||||||
width: 80rpx;
|
|
||||||
}
|
|
||||||
.modal-unit {
|
|
||||||
margin-left: 10rpx;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
.modal-btn-wrap {
|
.modal-btn-wrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20rpx;
|
gap: 20rpx;
|
||||||
|
|
@ -135,4 +168,13 @@ export default {
|
||||||
color: #6C6C6C;
|
color: #6C6C6C;
|
||||||
margin-left: 6rpx;
|
margin-left: 6rpx;
|
||||||
}
|
}
|
||||||
|
/deep/ .uni-forms-item__label {
|
||||||
|
padding: 0!important;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
width: 154rpx!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .uni-forms-item:nth-child(2) {
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
<uni-col :span="17">
|
<uni-col :span="17">
|
||||||
<!-- confirm:confirm; input:change; cancel:点击取消;
|
<!-- confirm:confirm; input:change; cancel:点击取消;
|
||||||
clear:点击清除;focus:获取焦点;blur:失去焦点 -->
|
clear:点击清除;focus:获取焦点;blur:失去焦点 -->
|
||||||
<uni-search-bar :focus="true" bgColor="#fbfdfe"
|
<uni-search-bar :focus="true"
|
||||||
|
bgColor="#fbfdfe"
|
||||||
v-model="searchValue"
|
v-model="searchValue"
|
||||||
cancelButton="always"
|
cancelButton="always"
|
||||||
@input="input"
|
@input="input"
|
||||||
|
|
@ -60,7 +61,8 @@
|
||||||
<text>加载中...</text>
|
<text>加载中...</text>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="noMore" class="no-more">没有更多数据了</view>
|
<view v-else-if="noMore" class="no-more">没有更多数据了</view>
|
||||||
<view class="add-agri" @tap="handleAddAgri">
|
<!-- v-if="store.getters.name !== 'admin'"-->
|
||||||
|
<view class="add-agri" @tap="handleAddAgri" >
|
||||||
<image :src="imageSrc" :style="'width:'+80+'rpx;height:'+80+'rpx'"></image>
|
<image :src="imageSrc" :style="'width:'+80+'rpx;height:'+80+'rpx'"></image>
|
||||||
<text class="text">点击添加大棚</text>
|
<text class="text">点击添加大棚</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -84,6 +86,11 @@ import {getNewSpecialData} from "../api/data/specialData";
|
||||||
import AddAgri from "./home/addAgri.vue";
|
import AddAgri from "./home/addAgri.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
computed: {
|
||||||
|
store() {
|
||||||
|
return store
|
||||||
|
}
|
||||||
|
},
|
||||||
components: {AddAgri, CustomRefresher, ZPaging},
|
components: {AddAgri, CustomRefresher, ZPaging},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,19 @@ export default {
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 自定义提示窗
|
||||||
|
* @param content
|
||||||
|
* @param tag
|
||||||
|
*/
|
||||||
|
customMsg(content,tag) {
|
||||||
|
uni.showToast({
|
||||||
|
title: content,
|
||||||
|
icon: tag,
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// 隐藏消息
|
// 隐藏消息
|
||||||
hideMsg(content) {
|
hideMsg(content) {
|
||||||
uni.hideToast()
|
uni.hideToast()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue