|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
- <view class="appWrapper">
|
|
|
-
|
|
|
+ <view class="appWrapper">
|
|
|
+
|
|
|
<!-- 站点新增start -->
|
|
|
- <form action="" @submit="formSubmit" v-if="!id">
|
|
|
+ <form action="" @submit="formSubmit" v-if="!deviceCode">
|
|
|
<view class="form-item margin-top">
|
|
|
<view class="title">
|
|
|
<text class="necessary">*</text>
|
|
@@ -11,83 +11,109 @@
|
|
|
<input name="deviceCode" v-model="formMess.deviceCode"></input>
|
|
|
</view>
|
|
|
<view class="form-item">
|
|
|
- <view class="title">设备名称:</view>
|
|
|
+ <view class="title"><text class="necessary">*</text>设备名称:</view>
|
|
|
<input name="input" v-model="formMess.deviceName"></input>
|
|
|
</view>
|
|
|
<view class="form-item">
|
|
|
- <view class="title">安装位置:</view>
|
|
|
+ <view class="title"><text class="necessary">*</text>安装位置:</view>
|
|
|
<input name="input" v-model="formMess.deviceInstallationPosition"></input>
|
|
|
</view>
|
|
|
<view class="form-item">
|
|
|
- <view class="title">所属楼层:</view>
|
|
|
- <select name="" id="" v-model="formMess.floor" filterable clearable>
|
|
|
- <option value="1" >楼层1</option>
|
|
|
- <option value="2" >楼层2</option>
|
|
|
+ <view class="title"><text class="necessary">*</text>所属楼层:</view>
|
|
|
+ <!-- <select name="" id="" v-model="formMess.floor" filterable clearable>
|
|
|
+ <option value="1" >楼层1</option>
|
|
|
+ <option value="2" >楼层2</option>
|
|
|
+ </select> -->
|
|
|
+ <select name="" id="" v-model="formMess.floor" filterable clearable>
|
|
|
+ <!-- <option value="" >请选择</option> -->
|
|
|
+ <option value="-10">楼层B10</option>
|
|
|
+ <option value="-9">楼层B9</option>
|
|
|
+ <option value="-8">楼层B8</option>
|
|
|
+ <option value="-7">楼层B7</option>
|
|
|
+ <option value="-6">楼层B6</option>
|
|
|
+ <option value="-5">楼层B5</option>
|
|
|
+ <option value="-4">楼层B4</option>
|
|
|
+ <option value="-3">楼层B3</option>
|
|
|
+ <option value="-2">楼层B2</option>
|
|
|
+ <option value="-1">楼层B1</option>
|
|
|
+ <option value="item" v-for="item in 60">楼层{{item}}</option>
|
|
|
</select>
|
|
|
</view>
|
|
|
<view class="form-item">
|
|
|
- <view class="title">站点:</view>
|
|
|
- <select name="" id="" v-model="formMess.siteId" filterable clearable>
|
|
|
- <option :value=item.id v-for="item in siteList">{{ item.siteName}}</option>
|
|
|
+ <view class="title"><text class="necessary">*</text>设备类型:</view>
|
|
|
+ <select name="" id="" v-model="formMess.deviceType" filterable clearable>
|
|
|
+ <option value="1">智慧用电</option>
|
|
|
+ <option value="2">视频监测</option>
|
|
|
</select>
|
|
|
</view>
|
|
|
<view class="form-item">
|
|
|
- <view class="title">设备类型:</view>
|
|
|
- <select name="" id="" v-model="formMess.deviceType" filterable clearable>
|
|
|
- <option value="1" >智慧用电</option>
|
|
|
- <option value="2" >视频监测</option>
|
|
|
+ <view class="title"><text class="necessary">*</text>站点:</view>
|
|
|
+ <select name="" id="" v-model="formMess.siteId" filterable clearable>
|
|
|
+ <option :value=item.id v-for="item in siteList">{{ item.siteName}}</option>
|
|
|
</select>
|
|
|
</view>
|
|
|
|
|
|
|
|
|
+
|
|
|
<view class="btn-area submitBottomBtn padding-lr-sm">
|
|
|
<button class="bg-blue round margin-top" @click="addSubmit">提 交 </button>
|
|
|
</view>
|
|
|
- </form>
|
|
|
- <!-- 站点新增end -->
|
|
|
-
|
|
|
- <!-- 站点修改start -->
|
|
|
- <form action="" @submit="formSubmit" v-else>
|
|
|
- <view class="form-item margin-top">
|
|
|
- <view class="title">
|
|
|
- <text class="necessary">*</text>
|
|
|
- 设备编号:
|
|
|
- </view>
|
|
|
- <input name="deviceCode" v-model="deviceMessage.deviceCode"></input>
|
|
|
- </view>
|
|
|
- <view class="form-item">
|
|
|
- <view class="title">设备名称:</view>
|
|
|
- <input name="input" v-model="deviceMessage.deviceName"></input>
|
|
|
- </view>
|
|
|
- <view class="form-item">
|
|
|
- <view class="title">安装位置:</view>
|
|
|
- <input name="input" v-model="deviceMessage.deviceInstallationPosition"></input>
|
|
|
- </view>
|
|
|
- <view class="form-item">
|
|
|
- <view class="title">所属楼层:</view>
|
|
|
- <select name="" id="" v-model="deviceMessage.floor" filterable clearable>
|
|
|
- <option value="1" >楼层1</option>
|
|
|
- <option value="2" >楼层2</option>
|
|
|
- </select>
|
|
|
- </view>
|
|
|
- <view class="form-item">
|
|
|
- <view class="title">站点:</view>
|
|
|
- <select name="" id="" v-model="deviceMessage.siteId" filterable clearable>
|
|
|
- <option :value=item.id v-for="item in siteList">{{ item.siteName}}</option>
|
|
|
- </select>
|
|
|
- </view>
|
|
|
- <view class="form-item">
|
|
|
- <view class="title">设备类型:</view>
|
|
|
- <select name="" id="" v-model="deviceMessage.deviceType" filterable clearable>
|
|
|
- <option value="1" >智慧用电</option>
|
|
|
- <option value="2" >视频监测</option>
|
|
|
- </select>
|
|
|
- </view>
|
|
|
-
|
|
|
-
|
|
|
- <view class="btn-area submitBottomBtn padding-lr-sm">
|
|
|
- <button class="bg-blue round margin-top" @click="editSubmit">提 交 </button>
|
|
|
- </view>
|
|
|
+ </form>
|
|
|
+ <!-- 站点新增end -->
|
|
|
+
|
|
|
+ <!-- 站点修改start -->
|
|
|
+ <form action="" @submit="formSubmit" v-else>
|
|
|
+ <view class="form-item margin-top">
|
|
|
+ <view class="title">
|
|
|
+ <text class="necessary">*</text>
|
|
|
+ 设备编号:
|
|
|
+ </view>
|
|
|
+ <input name="deviceCode" v-model="deviceMessage.deviceCode"></input>
|
|
|
+ </view>
|
|
|
+ <view class="form-item">
|
|
|
+ <view class="title"><text class="necessary">*</text>设备名称:</view>
|
|
|
+ <input name="input" v-model="deviceMessage.deviceName"></input>
|
|
|
+ </view>
|
|
|
+ <view class="form-item">
|
|
|
+ <view class="title"><text class="necessary">*</text>安装位置:</view>
|
|
|
+ <input name="input" v-model="deviceMessage.deviceInstallationPosition"></input>
|
|
|
+ </view>
|
|
|
+ <view class="form-item">
|
|
|
+ <view class="title"><text class="necessary">*</text>所属楼层:</view>
|
|
|
+ <select name="" id="" v-model="deviceMessage.floor" filterable clearable>
|
|
|
+ <!-- <option value="" >请选择</option> -->
|
|
|
+ <option value="-10">楼层B10</option>
|
|
|
+ <option value="-9">楼层B9</option>
|
|
|
+ <option value="-8">楼层B8</option>
|
|
|
+ <option value="-7">楼层B7</option>
|
|
|
+ <option value="-6">楼层B6</option>
|
|
|
+ <option value="-5">楼层B5</option>
|
|
|
+ <option value="-4">楼层B4</option>
|
|
|
+ <option value="-3">楼层B3</option>
|
|
|
+ <option value="-2">楼层B2</option>
|
|
|
+ <option value="-1">楼层B1</option>
|
|
|
+ <option :value=index+1 v-for="(item,index) in 60">楼层{{item}}</option>
|
|
|
+ </select>
|
|
|
+ </view>
|
|
|
+ <view class="form-item">
|
|
|
+ <view class="title"><text class="necessary">*</text>设备类型:</view>
|
|
|
+ <select name="" id="" v-model="deviceMessage.deviceType" filterable clearable>
|
|
|
+ <option value="1">智慧用电</option>
|
|
|
+ <option value="2">视频监测</option>
|
|
|
+ </select>
|
|
|
+ </view>
|
|
|
+ <view class="form-item">
|
|
|
+ <view class="title"><text class="necessary">*</text>站点:</view>
|
|
|
+ <select name="" id="" v-model="deviceMessage.siteId" filterable clearable>
|
|
|
+ <option :value=item.id v-for="item in siteList">{{ item.siteName}}</option>
|
|
|
+ </select>
|
|
|
+ </view>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <view class="btn-area submitBottomBtn padding-lr-sm">
|
|
|
+ <button class="bg-blue round margin-top" @click="editSubmit">提 交 </button>
|
|
|
+ </view>
|
|
|
</form>
|
|
|
<!-- 站点修改end -->
|
|
|
</view>
|
|
@@ -96,52 +122,91 @@
|
|
|
<script>
|
|
|
export default {
|
|
|
data() {
|
|
|
- return {
|
|
|
- siteList:[],
|
|
|
-
|
|
|
- id: 0,
|
|
|
- formMess: {
|
|
|
-
|
|
|
+ return {
|
|
|
+ siteList: [],
|
|
|
+ id: 0,
|
|
|
+ deviceCode:'',
|
|
|
+ formMess: {
|
|
|
"deviceCode": "",
|
|
|
"siteId": "",
|
|
|
"deviceType": "",
|
|
|
"deviceName": "",
|
|
|
"deviceInstallationPosition": "",
|
|
|
"floor": "",
|
|
|
- },
|
|
|
- deviceMessage:{}
|
|
|
+ },
|
|
|
+ deviceMessage: {}
|
|
|
}
|
|
|
- },
|
|
|
-
|
|
|
- onLoad: function(option) {
|
|
|
- this.id=option.id
|
|
|
- this.getSiteList()
|
|
|
- if (option.id) {
|
|
|
- uni.setNavigationBarTitle({
|
|
|
- title: '设备修改'
|
|
|
- });
|
|
|
- this.getDeviceList({"siteId":option.id})
|
|
|
- } else {
|
|
|
- uni.setNavigationBarTitle({
|
|
|
- title: '设备新增'
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ },
|
|
|
+
|
|
|
+ onLoad: function(option) {
|
|
|
+ this.id = option.id
|
|
|
+ this.deviceCode=option.deviceCode
|
|
|
+ this.getSiteList()
|
|
|
+ if (option.deviceCode) {
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: '设备修改'
|
|
|
+ });
|
|
|
+ this.getDeviceList({
|
|
|
+ "siteId": option.id,
|
|
|
+ "deviceCode": option.deviceCode
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: '设备新增'
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
//新增验证并提交
|
|
|
- addSubmit() {
|
|
|
- if (!this.formMess.deviceCode) {
|
|
|
- uni.showToast({
|
|
|
- title: "请填写设备名称",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- return
|
|
|
+ addSubmit() {
|
|
|
+ if (!this.formMess.deviceCode) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请填写设备编号",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.formMess.deviceName) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请填写设备名称",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.formMess.deviceInstallationPosition) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请填写安装位置",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.formMess.floor) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择所属楼层",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.formMess.deviceType) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择设备类型",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
}
|
|
|
+ if (!this.formMess.siteId) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择站点",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
this.setAddDevice({
|
|
|
"deviceCode": this.formMess.deviceCode,
|
|
|
"siteId": this.formMess.siteId,
|
|
@@ -150,99 +215,135 @@
|
|
|
"deviceInstallationPosition": this.formMess.deviceInstallationPosition,
|
|
|
"floor": this.formMess.floor
|
|
|
})
|
|
|
- },
|
|
|
-
|
|
|
- //编辑验证并提交
|
|
|
- editSubmit() {
|
|
|
- if (!this.deviceMessage.deviceCode) {
|
|
|
- uni.showToast({
|
|
|
- title: "请填写设备名称",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- return
|
|
|
- }
|
|
|
- this.setEditDevice({
|
|
|
- "deviceCode": this.deviceMessage.deviceCode,
|
|
|
- "siteId": this.deviceMessage.siteId,
|
|
|
- "deviceType": this.deviceMessage.deviceType,
|
|
|
- "deviceName": this.deviceMessage.deviceName,
|
|
|
- "deviceInstallationPosition": this.deviceMessage.deviceInstallationPosition,
|
|
|
- "floor": this.deviceMessage.floor
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
+ },
|
|
|
+
|
|
|
+ //编辑验证并提交
|
|
|
+ editSubmit() {
|
|
|
+ if (!this.deviceMessage.deviceCode) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请填写设备编号",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.deviceMessage.deviceName) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请填写设备名称",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.deviceMessage.deviceInstallationPosition) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请填写安装位置",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.deviceMessage.floor) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择所属楼层",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.deviceMessage.deviceType) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择设备类型",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.deviceMessage.siteId) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择站点",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.setEditDevice({
|
|
|
+ "deviceCode": this.deviceMessage.deviceCode,
|
|
|
+ "siteId": this.deviceMessage.siteId,
|
|
|
+ "deviceType": this.deviceMessage.deviceType,
|
|
|
+ "deviceName": this.deviceMessage.deviceName,
|
|
|
+ "deviceInstallationPosition": this.deviceMessage.deviceInstallationPosition,
|
|
|
+ "floor": this.deviceMessage.floor
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
// 新增请求
|
|
|
async setAddDevice(ming = {}) {
|
|
|
const res = await this.$myRequest({
|
|
|
url: 'DeviceManagement/setAddDevice',
|
|
|
data: ming
|
|
|
- })
|
|
|
- if (!res.data.flag) {
|
|
|
- uni.showToast({
|
|
|
- title: "添加失败",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: "添加成功",
|
|
|
- });
|
|
|
- }
|
|
|
- setTimeout(() => {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/deviceManage/deviceManage',
|
|
|
- });
|
|
|
+ })
|
|
|
+ if (!res.data.flag) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "添加失败",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: "添加成功",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/siteManage/siteManage',
|
|
|
+ });
|
|
|
}, 1000);
|
|
|
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 站点下拉
|
|
|
- async getSiteList(ming = {}) {
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: 'SiteManagement/getSiteList',
|
|
|
- data: ming
|
|
|
- })
|
|
|
- // this.deviceMessage=res.data.data[0];
|
|
|
- this.siteList=res.data.data
|
|
|
- // console.log(res.data.data)
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- // 修改回显请求
|
|
|
- async getDeviceList(ming = {}) {
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: 'DeviceManagement/getDeviceList',
|
|
|
- data: ming
|
|
|
- })
|
|
|
- console.log('res.data.data')
|
|
|
- console.log(res.data.data[0])
|
|
|
- this.deviceMessage=res.data.data[0];
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- // 编辑请求
|
|
|
- async setEditDevice(ming = {}) {
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: 'DeviceManagement/setEditDevice',
|
|
|
- data: ming
|
|
|
- })
|
|
|
- if (!res.data.flag) {
|
|
|
- uni.showToast({
|
|
|
- title: "编辑失败",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: "编辑成功",
|
|
|
- });
|
|
|
- }
|
|
|
- setTimeout(() => {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/deviceManage/deviceManage',
|
|
|
- });
|
|
|
- }, 1000);
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 站点下拉
|
|
|
+ async getSiteList(ming = {}) {
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: 'SiteManagement/getSiteList',
|
|
|
+ data: ming
|
|
|
+ })
|
|
|
+ // this.deviceMessage=res.data.data[0];
|
|
|
+ this.siteList = res.data.data
|
|
|
+ // console.log(res.data.data)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ // 修改回显请求
|
|
|
+ async getDeviceList(ming = {}) {
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: 'DeviceManagement/getDeviceList',
|
|
|
+ data: ming
|
|
|
+ })
|
|
|
+ console.log('res.data.data')
|
|
|
+ console.log(res.data.data[0])
|
|
|
+ this.deviceMessage = res.data.data[0];
|
|
|
+ console.log(this.deviceMessage)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ // 编辑请求
|
|
|
+ async setEditDevice(ming = {}) {
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: 'DeviceManagement/setEditDevice',
|
|
|
+ data: ming
|
|
|
+ })
|
|
|
+ if (!res.data.flag) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "编辑失败",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: "编辑成功",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/deviceManage/deviceManage',
|
|
|
+ });
|
|
|
+ }, 1000);
|
|
|
},
|
|
|
|
|
|
}
|