Ming пре 4 година
родитељ
комит
6f8013d4f5

+ 1 - 1
pages.json

@@ -284,7 +284,7 @@
 		}, {
 			"path": "pages/deviceManage/deviceAdd/deviceAdd",
 			"style": {
-				"navigationBarTitleText": "新增",
+				"navigationBarTitleText": "设备新增",
 				"enablePullDownRefresh": false
 			}
 		}

+ 435 - 164
pages/deviceManage/deviceAdd/deviceAdd.vue

@@ -1,4 +1,3 @@
-
 <template>
 	<view class="appWrapper padding-top" style="height:calc(100vh - 250rpx);overflow:scroll">
 
@@ -8,50 +7,67 @@
 					<text class="necessary">*</text>
 					设备编号:
 				</view>
-				<input name="input" v-model="formMess.deviceNo"></input>
+				<input name="input" v-model="formMess.device_code"></input>
 			</view>
 			<view class="form-item">
 				<view class="title"><text class="necessary">*</text>设备名称:</view>
-				<input name="input" v-model="formMess.deviceName"></input>
+				<input name="input" v-model="formMess.device_name"></input>
 			</view>
 			<view class="form-item">
 				<view class="title"><text class="necessary">*</text>单元地址:</view>
-				<input name="input" v-model="formMess.place"></input>
+				<input name="input" v-model="formMess.unitinfo"></input>
 			</view>
 			<view class="form-item">
 				<view class="title"><text class="necessary">*</text>所属楼层:</view>
-				<select name="" id="">
-					<option value="">楼层一</option>
-					<option value="">楼层一</option>
-					<option value="">楼层一</option>
+				<select name="" id="" v-model="formMess.louyu" 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>
-				<input name="input" v-model="formMess.place"></input>
+				<view class="title"><text class="necessary">*</text>物联网卡号:</view>
+				<input name="input" v-model="formMess.sim"></input>
 			</view>
 			<view class="form-item">
 				<view class="title"><text class="necessary">*</text>所属单位:</view>
-				<select name="" id="">
-					<option value="">楼层一</option>
-					<option value="">楼层一</option>
-					<option value="">楼层一</option>
+				<select name="" id="" v-model="formMess.company_code">
+					<option value="0">请选择</option>
+					<option :value="item.owner_code" v-for="(item,index) in companyListData" :key="index"
+						style="width:80%">{{item.owner_name}}</option>
 				</select>
 			</view>
 			<view class="form-item">
 				<view class="title"><text class="necessary">*</text>设备类型:</view>
-				<select name="" id="">
-					<option value="">类型一</option>
-					<option value="">类型一</option>
-					<option value="">类型一</option>
+				<select name="" id="" placeholder="" v-model="formMess.type">
+					<option value="0">请选择设备类型</option>
+					<option value="1">用传</option>
+					<option value="2">水表</option>
+					<option value="3">烟感</option>
+					<option value="4">消防栓</option>
+					<option value="5">液位</option>
+					<option value="6">RTU</option>
+					<option value="7">电气火灾</option>
+					<option value="16">视频监测</option>
 				</select>
 			</view>
 			<view class="form-item">
 				<view class="title"><text class="necessary">*</text>传输方式:</view>
-				<select name="" id="">
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-					<option value="">方式一</option>
+
+				<select name="" id="" placeholder="" v-model="formMess.transfer_type">
+					<option value="0">请选择传输方式</option>
+					<option  v-if="this.formMess.type!=1&&this.formMess.type!=7" value="NB">NB</option>
+					<option value="4G">4G</option>
+					<option v-if="this.formMess.type!=1&&this.formMess.type!=7" value="Lora">Lora</option>
 				</select>
 			</view>
 			<view class="form-item margin-top">
@@ -59,102 +75,147 @@
 					<text class="necessary">*</text>
 					是否顶楼
 				</view>
-				<radio-group name="gender">
+				<radio-group name="gender" @change="radioChange">
 					<label class="margin-right">
-						<radio value="是"/><text>是</text>
+						<radio value="1" /><text>是</text>
 					</label>
 					<label>
-						<radio value="否"  checked /><text>否</text>
+						<radio value="0" checked /><text>否</text>
 					</label>
 				</radio-group>
 			</view>
+
+
+			<!-- 水表NB必填参数 start -->
+			<block v-if="this.formMess.transfer_type=='NB'&&this.formMess.type==2">
+				<view class="form-item" >
+					<view class="title"><text class="necessary">*</text>NB类型:</view>
+					<select name="" id=""  v-model="formMess.deviceType">
+<!-- 						<option value="">烟感</option>
+ -->						<option value="MultiSensor">水表</option>
+						<option value="WaterMeter">宇洁戎情水表</option>
+						<option value="topsailSensor">拓扑索尔</option>
+					</select>
+				</view>
+				<view class="form-item" >
+					<view class="title"><text class="necessary">*</text>NB厂商名称:</view>
+					<select name="" id="" v-model="formMess.manufacturerName">
+						<option value="ST">ST</option>
+						<option value="ZHYQ">ZHYQ</option>
+						<option value="shanghaijunyanTest">shanghaijunyanTest</option>
+						<option value="Topsail">Topsail</option>
+					</select>
+				</view>
+				<view class="form-item" >
+					<view class="title"><text class="necessary">*</text>NB设备型号:</view>
+					<select name="" id="" v-model="formMess.model">
+						<!-- <option value="">烟感型号</option> -->
+						<option value="PT124B-2892-010">水表型号</option>
+						<option value="WPTA">宇洁戎情水表型号</option>
+						<option value="TH12">拓扑索尔水表液位</option>
+					</select>
+				</view>
+				<view class="form-item" >
+					<view class="title"><text class="necessary">*</text>NB厂商id:</view>
+					<select name="" id="" v-model="formMess.manufacturerId">
+						<option value="ST">ST</option>
+						<option value="ZHYQ">ZHYQ</option>
+						<option value="JunyanTest">JunyanTest</option>
+						<option value="Topsail">Topsail</option>
+					</select>
+				</view>
+				<view class="form-item" >
+					<view class="title"><text class="necessary">*</text>NB地址:</view>
+					<input name="input" v-model="formMess.location"></input>
+				</view>
+				<view class="form-item" >
+					<view class="title"><text class="necessary">*</text>NB协议:</view>
+					<input name="input" v-model="formMess.protocolType"></input>
+				</view>
+				
+			</block>
+			<!-- 水表NB必填参数 end -->
 			
-			<!-- <view class="form-item">
-				<view class="title"><text class="necessary">*</text>传输方式:</view>
-				<select name="" id="">
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-				</select>
-			</view> -->
-			
-			<view class="form-item">
-				<view class="title"><text class="necessary">*</text>NB类型:</view>
-				<select name="" id="">
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-				</select>
-			</view>
-			
-			<view class="form-item">
-				<view class="title"><text class="necessary">*</text>NB厂商名称:</view>
-				<select name="" id="">
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-				</select>
-			</view>
-			
-			<view class="form-item">
-				<view class="title"><text class="necessary">*</text>NB设备型号:</view>
-				<select name="" id="">
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-				</select>
-			</view>
+			<!-- 用传4G必填参数 -->
+			<block v-if="this.formMess.type==1&&this.formMess.transfer_type=='4G'">
+				<view class="form-item"  >
+					<view class="title"><text class="necessary">*</text>解析方法:</view>
+					<select name="" id="" v-model="formMess.owner_xh_a">
+						<option value="z">请选择</option>
+						<option :value=item v-for="item in 7">方法{{item}}</option>
+					</select>
+				</view>
+				<view class="form-item">
+					<view class="title"></view>
+					<select name="" id="" v-model="formMess.owner_xh_b">
+						<option value="z">请选择</option>
+						<option :value=item v-for="item in 7">方法{{item}}</option>
+					</select>
+				</view>
+				<view class="form-item">
+					<view class="title"></view>
+					<select name="" id="" v-model="formMess.owner_xh_c">
+						<option value="z">请选择</option>
+						<option :value=item v-for="item in 7">方法{{item}}</option>
+					</select>
+				</view>
+				
+			</block>
 			
-			<view class="form-item">
-				<view class="title"><text class="necessary">*</text>NB地址:</view>
-				<input name="input" v-model="formMess.deviceNo"></input>
-			</view>
 			
-			<view class="form-item">
-				<view class="title"><text class="necessary">*</text>NB协议:</view>
-				<input name="input" v-model="formMess.deviceNo"></input>
-			</view>
+			<!-- 电气火灾参数 start -->
+			<block v-if="this.formMess.type==7&&this.formMess.transfer_type=='4G'">
+				<view class="form-item">
+					<view class="title"><text class="necessary">*</text>最高层:</view>
+					<select name="" id="" v-model="formMess.max_level" 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"><text class="necessary">*</text>最底层:</view>
+					<select name="" id="" v-model="formMess.min_level" 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">
+						<text class="necessary">*</text>
+						倍率:
+					</view>
+					<input name="input" v-model="formMess.owner_bl"></input>
+				</view>
+			</block>
+			<!-- 电气火灾参数 end -->
 			
-			<view class="form-item">
-				<view class="title"><text class="necessary">*</text>NB厂商id:</view>
-				<select name="" id="">
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-				</select>
-			</view>
-			<view class="form-item">
-				<view class="title"><text class="necessary">*</text>解析方法:</view>
-				<select name="" id="">
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-				</select>
-			</view>
-			<view class="form-item">
-				<view class="title"></view>
-				<select name="" id="">
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-				</select>
-			</view>
-			<view class="form-item">
-				<view class="title"></view>
-				<select name="" id="">
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-					<option value="">方式一</option>
-				</select>
-			</view>
-		
 
 			<view class="btn-area submitBottomBtn padding-lr-sm">
-				<button class="bg-blue round  margin-top">提 交 </button>
+				<button class="bg-blue round  margin-top" @tap="submit()">提 交 </button>
 			</view>
 		</form>
-		
-		
+
+
 	</view>
 </template>
 
@@ -162,84 +223,297 @@
 	// var graceChecker = require("../../common/graceChecker.js");
 	// import add from '../../common/select.js';
 	export default {
-		
+
 		data() {
 			return {
-				index: -1,
-				picker: ['楼层一', '楼层二', '楼层三'],
-				type: '0',
 
+				companyListData: [],
+				index: -1,
+	
 
+				
+				
+				
 				formMess: {
-					"userName": "sss",
-					"place": "",
-					"longitude": "",
-					"dimension": "",
-					"contactor": "",
-					"mobile": "",
+					"device_code":"",
+					"device_name":"",
+					"unitinfo":"",
+					"louyu": "",
+					"sim":"",
+					company_code: 0,
+					
+					"type":0,
+					transfer_type: 0,
+					
+					"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'
+					
+	
 				},
+
 				
-				// 站点多选下拉
-				data2: [
-					{id: 1, value: '选项1'},
-					{id: 2, value: '选项2'},
-					{id: 3, value: '选项3'},
-					{id: 4, value: '选项4'},
-					{id: 5, value: '选项5'},
-					{id: 6, value: '这是6'},
-					{id: 7, value: '这是7'},
-					{id: 8, value: '这是8'},
-					{id: 9, value: '这是9'},
-					{id: 10, value: '这是10'},
-				],
-				// 站点多选下拉 end
 
 
 			}
 		},
 		onLoad: function(option) {
-			
+			this.getSiteList();
 
 
+
+		},
+		watch: {
+			
 		},
 		methods: {
-			// 站点多选下拉
-			getBackVal:function(e){
-				console.log(e)
-			},
-			// 站点多选下拉 end
+
+			async submit() {
+				//提交验证
+				
+				// if (!this.formMess.device_code.replace(/^\s*/g,'')) {
+				// 	uni.showToast({
+				// 		title: "请输入设备编号",
+				// 		icon: "none"
+				// 	});
+				// 	return
+				// }
+				// if (!this.formMess.device_name.replace(/^\s*/g,'')) {
+				// 	uni.showToast({
+				// 		title: "请输入设备名称",
+				// 		icon: "none"
+				// 	});
+				// 	return
+				// }
+				// if (!this.formMess.unitinfo.replace(/^\s*/g,'')) {
+				// 	uni.showToast({
+				// 		title: "请输入单元地址",
+				// 		icon: "none"
+				// 	});
+				// 	return
+				// }
+				// if (!this.formMess.louyu) {
+				// 	uni.showToast({
+				// 		title: "请选择所属楼层",
+				// 		icon: "none"
+				// 	});
+				// 	return
+				// }
+				// if (!this.formMess.sim.replace(/^\s*/g,'')) {
+				// 	uni.showToast({
+				// 		title: "请输入物联网卡号",
+				// 		icon: "none"
+				// 	});
+				// 	return
+				// }
+				// if (!this.formMess.company_code) {
+				// 	uni.showToast({
+				// 		title: "请选择所在单位",
+				// 		icon: "none"
+				// 	});
+				// 	return
+				// }
+				// if (!this.formMess.type) {
+				// 	uni.showToast({
+				// 		title: "请选择设备类型",
+				// 		icon: "none"
+				// 	});
+				// 	return
+				// }
+				// if (!this.formMess.transfer_type) {
+				// 	uni.showToast({
+				// 		title: "请选择传输方式",
+				// 		icon: "none"
+				// 	});
+				// 	return
+				// }
+				
+				if(this.formMess.type==1&&this.formMess.transfer_type=="4G"){
+					if (this.formMess.owner_xh_a=='z') {
+						uni.showToast({
+							title: "请选择第一个解析方法",
+							icon: "none"
+						});
+						return
+					}
+					if (this.formMess.owner_xh_b=='z') {
+						uni.showToast({
+							title: "请选择第二个解析方法",
+							icon: "none"
+						});
+						return
+					}
+					if (this.formMess.owner_xh_c=='z') {
+						uni.showToast({
+							title: "请选择第三个解析方法",
+							icon: "none"
+						});
+						return
+					}
+				}
+				
+				if(this.formMess.transfer_type=='NB'&&this.formMess.type==2){
+					if (!this.formMess.deviceType) {
+						uni.showToast({
+							title: "请选择水表设备类型",
+							icon: "none"
+						});
+						return
+					}
+					if (!this.formMess.manufacturerName) {
+						uni.showToast({
+							title: "请选择水表NB厂商名称",
+							icon: "none"
+						});
+						return
+					}
+					if (!this.formMess.model) {
+						uni.showToast({
+							title: "请选择水表NB设备型号",
+							icon: "none"
+						});
+						return
+					}
+					if (!this.formMess.manufacturerId) {
+						uni.showToast({
+							title: "请选择水表NB厂商ID",
+							icon: "none"
+						});
+						return
+					}
+					if (!this.formMess.location.replace(/^\s*/g,'')) {
+						uni.showToast({
+							title: "请输入水表NB地址",
+							icon: "none"
+						});
+						return
+					}
+					if (!this.formMess.protocolType.replace(/^\s*/g,'')) {
+						uni.showToast({
+							title: "请输入水表NB协议",
+							icon: "none"
+						});
+						return
+					}
+				}
+				
+				
+				if(this.formMess.type==7&&this.formMess.transfer_type=='4G'){
+					if (!this.formMess.max_level) {
+						uni.showToast({
+							title: "请选择最高层",
+							icon: "none"
+						});
+						return
+					}
+					if (!this.formMess.min_level) {
+						uni.showToast({
+							title: "请选择最低层",
+							icon: "none"
+						});
+						return
+					}
+					
+				
+					if (!this.formMess.owner_bl.replace(/^\s*/g,'')) {
+						uni.showToast({
+							title: "请输入倍率",
+							icon: "none"
+						});
+						return
+					}
+				}
+	
+				let queryParam = {};
+				queryParam.device_code = this.formMess.device_code;
+				queryParam.device_name = this.formMess.device_name;
+				queryParam.unitinfo = this.formMess.unitinfo;
+				queryParam.louyu = this.formMess.louyu;
+				queryParam.sim = this.formMess.sim;
+				
+				queryParam.company_code = this.formMess.company_code;
+				queryParam.type = this.formMess.type;
+				queryParam.transfer_type = this.formMess.transfer_type;
+				queryParam.is_top = this.formMess.radioOne;
+				
+				if (this.formMess.type==1&&this.formMess.transfer_type=="4G") {
+					alert(1)
+					queryParam.owner_xh_a = this.formMess.owner_xh_a;
+					queryParam.owner_xh_b = this.formMess.owner_xh_b;
+					queryParam.owner_xh_c = this.formMess.owner_xh_c;
+					this.addDevice(queryParam)
+					return;
+				}
+				if (this.formMess.transfer_type=='NB'&&this.formMess.type==2) {
+					alert(2)
+					queryParam.deviceType = this.formMess.deviceType;
+					queryParam.manufacturerName = this.formMess.manufacturerName;
+					queryParam.model = this.formMess.model;
+					queryParam.location = this.formMess.location;
+					queryParam.protocolType = this.formMess.protocolType;
+					queryParam.manufacturerId = this.formMess.manufacturerId;
+					this.addDevice(queryParam)
+					return;
+				}
+				if (this.formMess.type==7&&this.formMess.transfer_type=='4G') {
+					alert(3)
+					queryParam.max_level = this.formMess.max_level;
+					queryParam.min_level = this.formMess.min_level;
+					queryParam.owner_bl = this.formMess.owner_bl;
+					this.addDevice(queryParam)
+					return;
+				}
+				this.addDevice(queryParam)
 			
+			},
 			
-			formSubmit: function(e) {
-				console.log('form发生了submit事件,携带数据为:' + JSON.stringify(e.detail.value))
-				//定义表单规则
-				var rule = [{
-						name: "userName",
-						checkType: "string",
-						checkRule: "1,3",
-						errorMsg: "姓名应为1-3个字符..."
-					},
-					// {name:"gender", checkType : "in", checkRule:"男,女",  errorMsg:"请选择性别"},
-					// {name:"loves", checkType : "notnull", checkRule:"",  errorMsg:"请选择爱好"}
-				];
-				//进行表单检查
-				var formData = e.detail.value;
-				var checkRes = graceChecker.check(formData, rule);
-				if (checkRes) {
+			async addDevice(params = {}) {
+				const res = await this.$myRequest({
+					url: 'DeviceConfig/setDevice',
+					data: params
+				})
+				if (res.data.flag) {
 					uni.showToast({
-						title: "验证通过!",
-						icon: "none"
-					});
-				} else {
-					uni.showToast({
-						title: graceChecker.error,
-						icon: "none"
+						title: "提交成功",
 					});
+					setTimeout(() => {
+						uni.navigateTo({
+							url: '/pages/deviceManage/deviceManage',
+						});
+					}, 1000);
 				}
 			},
-			formReset: function(e) {
-				console.log('清空数据')
-			}
+			
+			
+
+			radioChange(e) {
+				console.log('type:' + e.detail.value);
+				this.formMess.radioOne = e.detail.value;
+			},
+
+			//单位下拉请求数据
+			async getSiteList() {
+				const res = await this.$myRequest({
+					url: 'Index/getCompanyList',
+				})
+				this.companyListData = res.data.data;
+			},
+
 
 
 
@@ -253,8 +527,6 @@
 
 
 <style lang="scss">
-
-
 	input,
 	select,
 	option {
@@ -273,7 +545,6 @@
 
 
 
-	
+
 	/* 站点多选下拉样式end */
 </style>
-

+ 4 - 8
pages/deviceManage/deviceManage.vue

@@ -45,7 +45,7 @@
 			<view class="processList deviceRegistList" style="height: calc(100vh - 470rpx);">
 				<checkbox-group @change="changeCheckbox">
 					<view class="cu-list menu-avatar ">
-						<view class=" site-item text-center margin-top" v-if="!deviceManage.length" >暂无结果</view>
+						<view class=" site-item text-center margin-top" v-if="!newDeviceManage.length" >暂无结果</view>
 						<view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''"
 							v-for="(item,index) in deviceManage" :key="index" :data-target="'move-box-' + index">
 							<view class="cu-form-group margin-top">
@@ -65,7 +65,7 @@
 								</view>
 								<view class="pro-date ">{{item.install_time}}</view>
 
-								<view class="showDetailEdit" v-if="item.isShow==true">
+								<view class="showDetailEdit" v-if="item.isShow">
 									<view @tap="goDeviceEdit(item)">修改设备</view>
 								<!-- 	<view @tap="deleteItem2" data-target="DialogModal2" :data-id='item.id'
 										:data-index='index'>删除设备</view> -->
@@ -233,14 +233,13 @@
 
 		mounted() {
 			document.addEventListener('click', (event) => {
-				console.log(this.deviceManage)
+				
 				
 				if (event.target.className != 'showDetailEdit') {
 					this.deviceManage.forEach(item => {
 						item.isShow = false;
-						// console.log(item)
 					})
-					// console.log(this.deviceManage)
+	
 
 				}
 			})
@@ -270,9 +269,6 @@
 				})
 				this.deviceManage = res.data.data;
 
-				// console.log(res.data.data.length)
-				console.log(this.deviceManage);
-
 			},
 
 			// 页面跳转

+ 1 - 1
pages/unprocessDetail/unprocessDetail.vue

@@ -174,7 +174,7 @@
 					queryParam.clwb = query;
 					queryParam.ncmd = this.getData.ncmd;
 					queryParam.clnr = this.msg;
-					alert(this.getData.dwtype)
+					
 					if (this.getData.dwtype == 1) {
 						queryParam.data3 = this.getData.data3;
 						queryParam.data5 = this.getData.data5;