|
@@ -0,0 +1,398 @@
|
|
|
+<template>
|
|
|
+ <view class="appWrapper padding-top" style="height:calc(100vh - 250rpx);overflow:scroll">
|
|
|
+
|
|
|
+ <form action="">
|
|
|
+ <!-- <view class="form-item ">
|
|
|
+ <view class="title">
|
|
|
+ <text class="necessary">*</text>
|
|
|
+ 设备编号:
|
|
|
+ </view>
|
|
|
+ <input name="input" v-model="device_code"></input>
|
|
|
+ </view> -->
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- <view class="form-item ">
|
|
|
+ <view class="title"><text class="necessary">*</text>物联网卡号:</view>
|
|
|
+ <input name="input" v-model="sim"></input>
|
|
|
+ </view>
|
|
|
+ <view class="form-item selectBox">
|
|
|
+ <view class="title"><text class="necessary">*</text>所属单位:</view>
|
|
|
+ <select name="" id="" filterable clearable v-model="company_code">
|
|
|
+ <option value="">请选择</option>
|
|
|
+ <option :value="item.owner_code" v-for="(item,index) in companyListData"
|
|
|
+ style="width:80%">{{item.owner_name}}</option>
|
|
|
+ </select>
|
|
|
+ <text class="icon iconfont margin-right-sm margin-left"></text>
|
|
|
+ </view> -->
|
|
|
+ <view class="form-item selectBox">
|
|
|
+ <view class="title"><text class="necessary">*</text>报备类型:</view>
|
|
|
+ <select name="" id="" placeholder=""clearable v-model="type">
|
|
|
+ <option value="">请选择</option>
|
|
|
+ <option value="1">单位</option>
|
|
|
+ <option value="2">类型</option>
|
|
|
+ <option value="3">设备</option>
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <text class="icon iconfont margin-right-sm margin-left"></text>
|
|
|
+ </view>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <view class="btn-area submitBottomBtn padding-lr-sm">
|
|
|
+ <button class="bg-blue round margin-top" @tap="submit()">提 交 </button>
|
|
|
+ </view>
|
|
|
+ </form>
|
|
|
+
|
|
|
+
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ // var graceChecker = require("../../common/graceChecker.js");
|
|
|
+ // import add from '../../common/select.js';
|
|
|
+ export default {
|
|
|
+
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+
|
|
|
+ companyListData: [],
|
|
|
+ index: -1,
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ "device_code":"",
|
|
|
+ "device_name":"",
|
|
|
+ "unitinfo":"",
|
|
|
+ "louyu": "",
|
|
|
+ "sim":"",
|
|
|
+ company_code: '',
|
|
|
+
|
|
|
+ "type":'',
|
|
|
+ transfer_type: '',
|
|
|
+
|
|
|
+ "owner_bl":"",//倍率
|
|
|
+ "is_top":"0", //是否顶楼
|
|
|
+
|
|
|
+ "deviceType":"",
|
|
|
+ "manufacturerName":"",
|
|
|
+ "model":"",
|
|
|
+ "location":"",
|
|
|
+ "protocolType":"",
|
|
|
+ "manufacturerId":"",
|
|
|
+
|
|
|
+ "min_level":"",
|
|
|
+ "max_level":"",
|
|
|
+
|
|
|
+ "radioOne":0,
|
|
|
+
|
|
|
+ "owner_xh_a":'z',
|
|
|
+ "owner_xh_b":'z',
|
|
|
+ "owner_xh_c":'z'
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad: function(option) {
|
|
|
+ this.getSiteList();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+
|
|
|
+ async submit() {
|
|
|
+ //提交验证
|
|
|
+
|
|
|
+ if (!this.device_code) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请输入设备编号",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ var reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{2,10}$/;
|
|
|
+ if(!reg.test(this.device_code)){
|
|
|
+ uni.showToast({
|
|
|
+ title: "请输入字母和数字结合的设备编号",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (!this.device_name.replace(/^\s*/g,'')) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请输入设备名称",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.unitinfo.replace(/^\s*/g,'')) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请输入单元地址",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.louyu) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择所属楼层",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.sim.replace(/^\s*/g,'')) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请输入物联网卡号",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.company_code) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择所在单位",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.type) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择设备类型",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.transfer_type) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择传输方式",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.type==1&&this.transfer_type=="4G"){
|
|
|
+ if (this.owner_xh_a=='z') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择第一个解析方法",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.owner_xh_b=='z') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择第二个解析方法",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.owner_xh_c=='z') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择第三个解析方法",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.transfer_type=='NB'&&(this.type==2||this.type==5)){
|
|
|
+ if (!this.deviceType) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择水表NB设备类型",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.manufacturerName) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择水表NB厂商名称",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.model) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择水表NB设备型号",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.manufacturerId) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择水表NB厂商ID",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.location.replace(/^\s*/g,'')) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请输入水表NB地址",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.protocolType.replace(/^\s*/g,'')) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请输入水表NB协议",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(this.type==7&&this.transfer_type=='4G'){
|
|
|
+ if (!this.max_level) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择最高层",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.min_level) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请选择最低层",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (!this.owner_bl.replace(/^\s*/g,'')) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请输入倍率",
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let queryParam = {};
|
|
|
+ queryParam.device_code = this.device_code;
|
|
|
+ queryParam.device_name = this.device_name;
|
|
|
+ queryParam.unitinfo = this.unitinfo;
|
|
|
+ queryParam.louyu = this.louyu;
|
|
|
+ queryParam.sim = this.sim;
|
|
|
+
|
|
|
+ queryParam.company_code = this.company_code;
|
|
|
+ queryParam.type = this.type;
|
|
|
+ queryParam.transfer_type = this.transfer_type;
|
|
|
+ queryParam.is_top = this.radioOne;
|
|
|
+
|
|
|
+ if (this.type==1&&this.transfer_type=="4G") {
|
|
|
+ queryParam.owner_xh_a = this.owner_xh_a;
|
|
|
+ queryParam.owner_xh_b = this.owner_xh_b;
|
|
|
+ queryParam.owner_xh_c = this.owner_xh_c;
|
|
|
+ this.addDevice(queryParam)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.transfer_type=='NB'&&(this.type==2||this.type==5)) {
|
|
|
+ queryParam.deviceType = this.deviceType;
|
|
|
+ queryParam.manufacturerName = this.manufacturerName;
|
|
|
+ queryParam.model = this.model;
|
|
|
+ queryParam.location = this.location;
|
|
|
+ queryParam.protocolType = this.protocolType;
|
|
|
+ queryParam.manufacturerId = this.manufacturerId;
|
|
|
+ this.addDevice(queryParam)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.type==7&&this.transfer_type=='4G') {
|
|
|
+ queryParam.max_level = this.max_level;
|
|
|
+ queryParam.min_level = this.min_level;
|
|
|
+ queryParam.owner_bl = this.owner_bl;
|
|
|
+ this.addDevice(queryParam)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.addDevice(queryParam)
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ async addDevice(params = {}) {
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: 'DeviceConfig/setDevice',
|
|
|
+ data: params
|
|
|
+ })
|
|
|
+ if (res.data.flag) {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: "提交成功",
|
|
|
+ // });
|
|
|
+ // setTimeout(() => {
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: '/pages/deviceManage/deviceManage',
|
|
|
+ // });
|
|
|
+ // }, 1000);
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/accountManage/success/success',
|
|
|
+ });
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ radioChange(e) {
|
|
|
+ console.log('type:' + e.detail.value);
|
|
|
+ this.radioOne = e.detail.value;
|
|
|
+ },
|
|
|
+
|
|
|
+ //单位下拉请求数据
|
|
|
+ async getSiteList() {
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: 'Index/getCompanyList',
|
|
|
+ })
|
|
|
+ this.companyListData = res.data.data;
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+ input,
|
|
|
+ select,
|
|
|
+ option {
|
|
|
+ line-height: 70rpx;
|
|
|
+ padding: 0 20rpx;
|
|
|
+ height: 70rpx;
|
|
|
+ border: 1px solid #EDEDED;
|
|
|
+ // width:500rpx!important;
|
|
|
+ background-color: #fff;
|
|
|
+ box-sizing: border-box;
|
|
|
+ appearance: none;
|
|
|
+ -moz-appearance: none;
|
|
|
+ -webkit-appearance: none;
|
|
|
+ color: #999;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /* 站点多选下拉样式end */
|
|
|
+</style>
|