123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- <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>
|