添加大棚修复
parent
4ee91d99b0
commit
6980614cbc
|
|
@ -0,0 +1,74 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询大棚信息(用户-设备关联)列表
|
||||||
|
export function listUserAgri(query) {
|
||||||
|
return request({
|
||||||
|
url: '/assets/userAgri/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询大棚信息(用户-设备关联)详细
|
||||||
|
export function getUserAgri(id) {
|
||||||
|
return request({
|
||||||
|
url: '/assets/userAgri/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function removeAgri(data) {
|
||||||
|
return request({
|
||||||
|
url: '/assets/userAgri/removeAgri',
|
||||||
|
method: 'delete',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 新增大棚信息(用户-设备关联)
|
||||||
|
export function addUserAgri(data) {
|
||||||
|
return request({
|
||||||
|
url: '/assets/userAgri',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改大棚信息(用户-设备关联)
|
||||||
|
export function updateUserAgri(data) {
|
||||||
|
return request({
|
||||||
|
url: '/assets/userAgri',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除大棚信息(用户-设备关联)
|
||||||
|
export function delUserAgri(id) {
|
||||||
|
return request({
|
||||||
|
url: '/assets/userAgri/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function findAgriUser(query) {
|
||||||
|
return request({
|
||||||
|
url: '/assets/userAgri/findAgriUser',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function findAllUser(query) {
|
||||||
|
return request({
|
||||||
|
url: '/assets/userAgri/findAllUser',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function batchAssociaUser(data) {
|
||||||
|
return request({
|
||||||
|
url: '/assets/userAgri/batchAssociaUser',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -83,7 +83,6 @@ export default {
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
close() {
|
close() {
|
||||||
this.$emit("reload")
|
|
||||||
this.$refs.addForm.close();
|
this.$refs.addForm.close();
|
||||||
},
|
},
|
||||||
confirm() {
|
confirm() {
|
||||||
|
|
@ -95,17 +94,18 @@ export default {
|
||||||
content: `${response.data.msg}`,
|
content: `${response.data.msg}`,
|
||||||
showCancal: false,
|
showCancal: false,
|
||||||
confirmText: '确定',
|
confirmText: '确定',
|
||||||
|
success: (res) => {
|
||||||
|
// 4. 只有用户点击弹窗的“确定”后,才执行后续操作
|
||||||
|
if (res.confirm) {
|
||||||
|
this.$emit("reload"); // 向父组件传值触发刷新
|
||||||
|
this.close(); // 关闭添加大棚的弹窗(移到这里)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.close();
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
uni.showModal({
|
return
|
||||||
title: `❌操作提示`,
|
|
||||||
content: `${err.errorMessage}`,
|
|
||||||
showCancal: false,
|
|
||||||
confirmText: '确定',
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
open() {
|
open() {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// 应用全局配置
|
// 应用全局配置
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// baseUrl: process.env.UNI_PLATFORM === 'mp-weixin'?"http://122.51.109.52:8088":(process.env.NODE_ENV === "production" ? "/api" : "http://localhost:8088"),
|
// baseUrl: process.env.UNI_PLATFORM === 'mp-weixin'?"http://122.51.109.52:8088":(process.env.NODE_ENV === "production" ? "/api" : "http://localhost:8088"),
|
||||||
baseUrl: process.env.NODE_ENV === "production"?"https://api.xiaoces.com/api":"http://172.14.24.107:8088",
|
baseUrl: process.env.NODE_ENV === "production"?"https://api.xiaoces.com/api":"http://localhost:8088",
|
||||||
// 应用信息
|
// 应用信息
|
||||||
appInfo: {
|
appInfo: {
|
||||||
// 应用名称
|
// 应用名称
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
<uni-swipe-action-item
|
<uni-swipe-action-item
|
||||||
v-for="(item, index) in listData"
|
v-for="(item, index) in listData"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
@click="onDeleteItem($event, item)"
|
||||||
:class="['list-item', { 'list-item-disabled': item.online === '离线' }]"
|
:class="['list-item', { 'list-item-disabled': item.online === '离线' }]"
|
||||||
:right-options="options">
|
:right-options="options">
|
||||||
<view class="item-card"
|
<view class="item-card"
|
||||||
|
|
@ -89,11 +90,12 @@
|
||||||
<script>
|
<script>
|
||||||
import ZPaging from "../uni_modules/z-paging/components/z-paging/z-paging.vue";
|
import ZPaging from "../uni_modules/z-paging/components/z-paging/z-paging.vue";
|
||||||
import CustomRefresher from "../components/custom-refresher/custom-refresher.vue";
|
import CustomRefresher from "../components/custom-refresher/custom-refresher.vue";
|
||||||
import {getAgriInfo} from "../api/system/assets/agri";
|
import { getAgriInfo} from "../api/system/assets/agri";
|
||||||
import store from "../store";
|
import store from "../store";
|
||||||
import TimeUtil from "../utils/TimeUtil";
|
import TimeUtil from "../utils/TimeUtil";
|
||||||
import {getNewSpecialData} from "../api/data/specialData";
|
import {getNewSpecialData} from "../api/data/specialData";
|
||||||
import AddAgri from "../components/addAgri/addAgri.vue";
|
import AddAgri from "../components/addAgri/addAgri.vue";
|
||||||
|
import {removeAgri} from "../api/system/assets/userAgri";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -233,8 +235,7 @@ export default {
|
||||||
getListData() {
|
getListData() {
|
||||||
this.noMore = false;
|
this.noMore = false;
|
||||||
this.listData = [];
|
this.listData = [];
|
||||||
if (this.isLoading || this.noMore) return;
|
this.isLoading = true
|
||||||
this.isLoading = true;
|
|
||||||
|
|
||||||
getAgriInfo().then(response => {
|
getAgriInfo().then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
|
|
@ -281,17 +282,34 @@ export default {
|
||||||
refresh() {
|
refresh() {
|
||||||
this.getListData();
|
this.getListData();
|
||||||
},
|
},
|
||||||
onDeleteItem(item) {
|
onDeleteItem(item, agri) {
|
||||||
console.info(`点击了${item.content.text}`)
|
console.info(`点击了${item.content.text},${agri}`)
|
||||||
|
if (item.content.text==='删除') {
|
||||||
|
uni.showModal({
|
||||||
|
title: '操作提示:',
|
||||||
|
content: `确定删除大棚【${agri.agriName}】?`,
|
||||||
|
cancelText: '取消',
|
||||||
|
confirmText: '确定',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
removeAgri(agri).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$modal.msgSuccess("删除成功!")
|
||||||
|
this.getListData();
|
||||||
|
} else {
|
||||||
|
this.$modal.msgError("删除失败!")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 点击列表项
|
// 点击列表项
|
||||||
onItemTap(item,index) {
|
onItemTap(item) {
|
||||||
console.info(item,index)
|
|
||||||
if (item.online==='离线') {
|
if (item.online==='离线') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.info(item)
|
|
||||||
var agri = JSON.stringify(
|
var agri = JSON.stringify(
|
||||||
{
|
{
|
||||||
imei:item.imei,
|
imei:item.imei,
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ class TimeUtil {
|
||||||
|
|
||||||
// 情况4:不支持的类型
|
// 情况4:不支持的类型
|
||||||
else {
|
else {
|
||||||
console.warn(`不支持的时间类型:${typeof time},仅支持数字、Date对象、字符串`);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue