zhangyun 4 роки тому
батько
коміт
ccbbff5f89

+ 42 - 1
pages.json

@@ -99,8 +99,49 @@
             "path" : "pages/fourMoodBase/index/index",
             "style" :                                                                                    
             {
+                "navigationBarTitleText": "设备分配",
+                "enablePullDownRefresh": false,
+				"navigationStyle":"custom"
+            }
+            
+        },
+		{
+		    "path" : "pages/fourMoodBase/index/addusers",
+		    "style" :                                                                                    
+		    {
+		        "navigationBarTitleText": "",
+		        "enablePullDownRefresh": false,
+				"navigationStyle":"custom"
+		    }
+		    
+		}
+        ,{
+            "path" : "pages/fourMoodBase/index/useroperation",
+            "style" :                                                                                    
+            {
                 "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
+                "enablePullDownRefresh": false,
+				"navigationStyle":"custom"
+            }
+            
+        }
+        ,{
+            "path" : "pages/fourMoodBase/index/changepasswold",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "",
+                "enablePullDownRefresh": false,
+				"navigationStyle":"custom"
+            }
+            
+        }
+        ,{
+            "path" : "pages/fourMoodBase/index/assignment",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "",
+                "enablePullDownRefresh": false,
+				"navigationStyle":"custom"
             }
             
         }

+ 260 - 0
pages/fourMoodBase/index/addusers.vue

@@ -0,0 +1,260 @@
+<template>
+	<view>
+		<view style="position: fixed;z-index: 100;top: 0;">
+			<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="用户新增"></uni-nav-bar>
+		</view>
+		<view class="addusers">
+			<u-form :model="form" ref="uForm" class="uForm">
+				<u-form-item label="姓名" left-icon="account" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom"
+				 prop="name" required>
+					<u-input v-model="form.name" :clearable="clearable" input-align="right" placeholder="请输入姓名" />
+				</u-form-item>
+				<u-form-item label="电话" left-icon="phone" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom"
+				 prop="intro" required>
+					<u-input v-model="form.intro" :clearable="clearable" input-align="right" placeholder="请输入电话" />
+				</u-form-item>
+				<u-form-item label="密码" left-icon="lock" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom"
+				 prop="passwold" required>
+					<u-input v-model="form.passwold" type="password" :clearable="clearable" input-align="right" placeholder="请输入密码" />
+				</u-form-item>
+				<u-form-item label="角色类型" left-icon="account-fill" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom">
+					<u-input v-model="form.typesofrole" type="select" :clearable="clearable" @click="typesofrole[0].show = true"
+					 input-align="right" placeholder="请选择角色类型" />
+				</u-form-item>
+				<u-form-item label="主题" left-icon="calendar" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom">
+					<u-input v-model="form.theme" type="select" :clearable="clearable" @click="theme_show = true" input-align="right"
+					 placeholder="请选择主题" />
+					<u-action-sheet :list="theme" v-model="theme_show" @click="themes" scroll-y="true"></u-action-sheet>
+				</u-form-item>
+				<u-form-item label="用户类型" left-icon="grid" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom">
+					<u-input v-model="form.usersofrole" type="select" :clearable="clearable" @click="usersofrole_show = true"
+					 input-align="right" :placeholder="usersofrole[0].text" />
+					<u-action-sheet :list="usersofrole" v-model="usersofrole_show" @click="usersofroles"></u-action-sheet>
+				</u-form-item>
+				<u-form-item label="测试用户" left-icon="eye" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom">
+					<u-input v-model="form.testuser" type="select" :clearable="clearable" @click="testuser_show = true" input-align="right"
+					 :placeholder="testuser[0].text" />
+					<u-action-sheet :list="testuser" v-model="testuser_show" @click="testusers"></u-action-sheet>
+				</u-form-item>
+			</u-form>
+		</view>
+		<button class="submitbtn" @click="addusers">确 定</button>
+		<u-popup v-model="typesofrole[0].show" mode="bottom" length="40%" class="pop-up">
+			<scroll-view scroll-y="true" class="sheet">
+				<view class="sheet-text" v-for="(item,index) in typesofrole[1]" :key="index">
+					<p @click="typesofroles(item.role_name,item.role_id)">{{item.role_name}}</p>
+				</view>
+			</scroll-view>
+			<button @click="typesofrole[0].show = false">取消</button>
+		</u-popup>
+	</view>
+</template>
+<style lang="scss">
+
+</style>
+<script>
+	export default {
+		data() {
+			return {
+				borderbottom: false,
+				clearable: false,
+				form: {
+					name: null,
+					intro: null,
+					passwold: null,
+					typesofrole: null,
+					typesofrole_id: null,
+					theme: null,
+					usersofrole: null,
+					usersofrole_id:null,
+					testuser: null,
+				},
+				rules: {
+					name: [{
+							required: true,
+							message: '请输入姓名',
+							// 可以单个或者同时写两个触发验证方式
+							trigger: 'blur,change'
+						},
+						{
+							validator: (rule, value, callback) => {
+								// 上面有说,返回true表示校验通过,返回false表示不通过
+								// this.$u.test.mobile()就是返回true或者false的
+								return value.length<10 && value.length>1
+							},
+							message: '请输入2-10个字符',
+							// 触发器可以同时用blur和change
+							trigger: ['change', 'blur'],
+						}
+					],
+					intro: [{
+						required: true,
+						message: '请输入手机号',
+						// 可以单个或者同时写两个触发验证方式
+						trigger: 'blur,change'
+					}, {
+						// 自定义验证函数,见上说明
+						validator: (rule, value, callback) => {
+							// 上面有说,返回true表示校验通过,返回false表示不通过
+							// this.$u.test.mobile()就是返回true或者false的
+							return this.$u.test.mobile(value);
+						},
+						message: '手机号格式不正确',
+						// 触发器可以同时用blur和change
+						trigger: ['change', 'blur'],
+					}],
+					passwold: {
+						required: true,
+						message: '请输入密码',
+						// 可以单个或者同时写两个触发验证方式
+						trigger: 'blur,change'
+					}
+				},
+				lefticonstyle: {
+					'color': '#57C878'
+				},
+				typesofrole: [{
+					show: false
+				}],
+				theme_show: false,
+				theme: [],
+				usersofrole_show: false,
+				usersofrole: [{
+					text: "超级管理员"
+				}, {
+					text: "经销商"
+				}, {
+					text: "农林政府单位"
+				}, {
+					text: "普通用户"
+				}],
+				testuser_show: false,
+				testuser: [{
+					text: "是"
+				}, {
+					text: "否"
+				}]
+			}
+		},
+		methods: {
+			typesofroles(value,id) {
+				this.form.typesofrole = value;
+				this.form.typesofrole_id=id
+				this.typesofrole[0].show = false
+			},
+			themes(index) {
+				this.form.theme = this.theme[index].text;
+			},
+			usersofroles(index) {
+				this.form.usersofrole = this.usersofrole[index].text;
+				this.form.usersofrole_id=index+1
+			},
+			testusers(index) {
+				this.form.testuser = this.testuser[index].text;
+			},
+			async getTypesofroles() {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=user.perms.role_list'
+				})
+				this.typesofrole.push(res)
+				console.log(res)
+			},
+			async getThemes() {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=pest.warning_record.rolemanage_view'
+				})
+				console.log(res.data)
+				for (var i=0;i<res.data.length;i++) {
+					let obj = {}
+					obj.text = res.data[i].role_describe
+					obj.role_id=res.data[i].id
+					this.theme.push(obj)
+				}
+			},
+			async getaddusers() {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=user.login.regiest',
+					data:{
+						 username:this.form.name,
+						 mobile:this.form.intro,
+						 password:this.form.passwold,
+						 role_id:this.form.typesofrole_id?this.form.typesofrole_id:1,
+						 user_type:this.form.usersofrole_id?this.form.usersofrole_id:1,
+						 cs_user:this.form.testuser=="是"?1:0
+					}
+				})
+			},
+			addusers(){
+				if(this.form.name&&this.form.intro&&this.form.passwold){
+					this.getaddusers()
+					uni.navigateTo({
+					    url: './index'
+					});
+				}
+			},
+			clickLeft(){
+				uni.navigateTo({
+				    url: './index'
+				});
+			}
+		},
+		onLoad() {
+			this.getTypesofroles()
+			this.getThemes()
+		},
+		onReady() {
+			this.$refs.uForm.setRules(this.rules);
+		}
+	}
+</script>
+
+<style lang="scss">
+	.addusers {
+		width: 100%;
+		display: flex;
+		justify-content: center;
+
+		.uForm {
+			margin-top: 88rpx;
+			width: 85%;
+		}
+	}
+
+	.submitbtn {
+		width: 100%;
+		position: absolute;
+		bottom: 80rpx;
+		background-color: $uni-color-success;
+		color: white;
+	}
+
+	.pop-up {
+		.sheet {
+			background-color: white;
+			height: 400rpx;
+			overflow: hidden;
+
+			.sheet-text {
+				height: 80rpx;
+
+				p {
+					text-align: center;
+					height: 80rpx;
+					line-height: 80rpx;
+					color: black;
+					font-size: 16px;
+				}
+			}
+
+		}
+
+		button {
+			color: black;
+			position: absolute;
+			bottom: 0;
+			width: 100%;
+			font-size: 16px;
+			height: 80rpx;
+		}
+	}
+</style>

+ 304 - 0
pages/fourMoodBase/index/assignment.vue

@@ -0,0 +1,304 @@
+<template>
+	<view>
+		<view style="position: fixed;z-index: 100;top: 0;">
+			<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备分配"></uni-nav-bar>
+		</view>
+		<view class="utabs">
+			<u-tabs :list="list" :is-scroll="true" :current="current" @change="change" item-width="140" font-size="24" gutter="20"
+			 bar-width="60" active-color="#42b983"></u-tabs>
+		</view>
+		<view class="ass_list">
+			<checkbox-group class="che_group" @change="checkboxchange">
+				<label class="equipment" v-for="(items,index) in assignment" :key="index">
+					<view class="equipment_top">
+						<image :src="items.src" mode="" class="equipment_top_img"></image>
+						<span class="equipment_top_name">{{list[items.device_type_id-1].name}}</span>
+						<checkbox :value="String(items.d_id)" :checked="items.device_user==user_info.uid" class="ucheckbox" color="#42b983" />
+					</view>
+					<view class="equipment_bot">
+						<p class="equipment_bot_id">设备ID:{{items.device_id}}</p>
+						<p class="equipment_bot_name">设备名称:{{items.device_name}}</p>
+						<view class="equipment_state">在线</view>
+					</view>
+				</label>
+			</checkbox-group>
+		</view>
+		<view class="allocbtn">
+			<button @click="cancel" class="cancel">取消分配</button>
+			<button @click="canfirm" class="canfirm">确定分配</button>
+		</view>
+	</view>
+</template>
+<style lang="scss">
+	.allocbtn {
+		width: 100%;
+		position: fixed;
+		bottom: 0;
+		z-index: 100;
+		display: flex;
+
+		button {
+			width: 50%;
+			font-size: 24rpx;
+			height: 80rpx;
+			line-height: 80rpx;
+			border-radius: 0;
+		}
+
+		.cancel {
+			background-color: #C8C7CC;
+			color: #555555;
+		}
+
+		.canfirm {
+			color: white;
+			background-color: #42b983;
+		}
+	}
+</style>
+<script>
+	export default {
+		data() {
+			return {
+				user_info: {},
+				list: [{
+					name: "全部"
+				}, {
+					name: "杀虫灯"
+				}, {
+					name: "测报灯"
+				}, {
+					name: "智能性诱"
+				}, {
+					name: "环境检测"
+				}, {
+					name: "监控设备"
+				}, {
+					name: "孢子仪"
+				}, {
+					name: "性诱设备"
+				}, {
+					name: "糖醋测报"
+				}, ],
+				current: 0,
+				assignment: [],
+				data: {
+					devicetypeid: '',
+					pagesize: 10,
+					page: 1
+				},
+				images: [{
+						path: "../../../static/image/fourMoodBase/杀虫灯.png",
+						id: 2
+					},
+					{
+						path: "../../../static/image/fourMoodBase/测报灯.png",
+						id: 3
+					}, {
+						path: "../../../static/image/fourMoodBase/性诱测报.png",
+						id: 4
+					}, {
+						path: "../../../static/image/fourMoodBase/环境监测.png",
+						id: 5
+					}, {
+						path: "../../../static/image/fourMoodBase/监控.png",
+						id: 6
+					}, {
+						path: "../../../static/image/fourMoodBase/孢子仪.png",
+						id: 7
+					}
+				],
+				allocationvalues: [], //原始数据
+				allocationvalues2: [], //选项框更改后的数据
+				allocationvalues3: [], //头部导航栏点击后的数据
+				allocationvaluesTF: false, //判断选项框是否变动
+				topbarTF: false //判断头部导航栏是否变更
+			}
+		},
+		methods: {
+			deweight(arr) {
+				var newArr = []
+				for (var i = 0; i < arr.length; i++) {
+					if (newArr.indexOf(arr[i]) === -1) {
+						newArr.push(arr[i])
+					}
+				}
+				return newArr
+			},
+			clickLeft() { //返回上一页
+				uni.navigateTo({
+					url: './useroperation?item=' + JSON.stringify(this.user_info)
+				})
+			},
+			change(index) { //头部导航栏的点击
+				this.topbarTF = true //更改导航栏状态
+				// this.allocationvalues3 = this.deweight(this.allocationvalues3.concat(this.allocationvalues2)) //合并数据
+				console.log(this.allocationvalues3)
+				this.current = index
+				this.data.page = 1
+				this.data.devicetypeid = ''
+				uni.pageScrollTo({
+					scrollTop: 0
+				});
+				if (index == 0) {
+					this.assignment = []
+					this.getAssign(this.data)
+				} else {
+					this.assignment = []
+					this.data.devicetypeid = index + 1
+					this.getAssign(this.data)
+				}
+
+			},
+			async getAssign(data) { //获取设备信息
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=device.device_manage.user_device_info',
+					data: {
+						owner_uid: this.user_info.uid,
+						device_type_id: data.devicetypeid,
+						page_size: data.pagesize,
+						page: data.page
+					}
+				})
+				this.assignment = this.assignment.concat(res.data)
+				for (var i = 0; i < this.assignment.length; i++) {
+					if (this.assignment[i].device_user != 0) {
+						this.allocationvalues.push(this.assignment[i].d_id)
+					}
+					for (var j = 0; j < this.images.length; j++) {
+						if (this.assignment[i].device_type_id == this.images[j].id) {
+							this.assignment[i].src = this.images[j].path
+						}
+					}
+				}
+			},
+			async allocation(data) { //分配设备
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=device.device_manage.allot_device',
+					data: {
+						device_ids: data.device_ids,
+						uid: data.uid
+					}
+				})
+			},
+			checkboxchange(e) { //多选框变动时
+				this.allocationvaluesTF = e._processed
+				this.allocationvalues2 =e.detail.value
+				if(this.topbarTF){
+					this.allocationvalues3=this.allocationvalues3.concat(e.detail.value)
+					console.log(e.detail.value)
+				}
+			},
+			canfirm() { //确定分配
+				let data = {}
+				if (this.topbarTF) {
+					data.device_ids = this.deweight(this.allocationvalues3.concat(this.allocationvalues)).join(',')
+				} else {
+					if (this.allocationvaluesTF) {
+						this.allocationvalues2 = this.deweight(this.allocationvalues2)
+						data.device_ids = this.allocationvalues2.join(',')
+					} else {
+						data.device_ids = this.allocationvalues.join(',')
+					}
+				}
+
+				data.uid = this.user_info.uid
+				this.allocation(data)
+				uni.navigateTo({
+					url: './useroperation?item=' + JSON.stringify(this.user_info)
+				})
+			},
+			cancel() { //取消分配
+				uni.navigateTo({
+					url: './useroperation?item=' + JSON.stringify(this.user_info)
+				})
+			},
+
+		},
+		onLoad(option) {
+			this.user_info = JSON.parse(option.item)
+			this.getAssign(this.data)
+		},
+		onReachBottom() {
+			this.data.page++
+			this.getAssign(this.data)
+		}
+	}
+</script>
+
+<style lang="scss">
+	.utabs {
+		width: 95%;
+		position: fixed;
+		top: 90rpx;
+		left: 2.5%;
+		z-index: 100;
+	}
+
+	.ass_list {
+		margin: 190rpx 0 0;
+
+		.che_group {
+			display: flex;
+			flex-direction: column;
+		}
+
+		.equipment {
+			width: 600rpx;
+			margin: 20rpx auto;
+			box-shadow: 0 0 10rpx #bcb9ca;
+			padding: 20rpx 30rpx;
+
+			.equipment_top {
+				height: 60rpx;
+				width: 100%;
+				border-bottom: 1px solid #dfe5ec;
+				position: relative;
+
+				.equipment_top_img {
+					width: 40rpx;
+					height: 40rpx;
+					position: absolute;
+				}
+
+				.equipment_top_name {
+					font-size: 12rpx;
+					margin-left: 60rpx;
+				}
+
+				.ucheckbox {
+					float: right;
+					margin: 0rpx -4rpx;
+					transform: scale(0.7);
+				}
+			}
+
+			.equipment_bot {
+				padding: 30rpx 0;
+				position: relative;
+
+				.equipment_bot_id {
+					font-weight: 700;
+					font-size: 15px;
+					margin-bottom: 16rpx;
+				}
+
+				.equipment_bot_name {
+					font-size: 10px;
+				}
+
+				.equipment_state {
+					position: absolute;
+					top: 20rpx;
+					right: 0;
+					width: 100rpx;
+					height: 100rpx;
+					text-align: center;
+					line-height: 100rpx;
+					color: #42b983;
+
+				}
+			}
+		}
+	}
+</style>

+ 154 - 0
pages/fourMoodBase/index/changepasswold.vue

@@ -0,0 +1,154 @@
+<template>
+	<view>
+		<view style="position: fixed;z-index: 100;top: 0;">
+			<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="修改密码"></uni-nav-bar>
+		</view>
+		<u-form :model="form" ref="uForm" class="uForm">
+			<view class="uFormbg">
+				<u-form-item label="原始密码" left-icon="lock" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom"
+				 prop="name">
+					<u-input v-model="form.oldpass" :clearable="clearable" input-align="right" placeholder="请输入原始密码" :type="type" @blur="oldpassblur"/>
+				</u-form-item>
+			</view>
+			<p class="tishi" v-if="oldpassisnull">请输入原始密码!</p>
+			<view class="uFormbg">
+				<u-form-item label="新密码" left-icon="lock" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom"
+				 prop="name">
+					<u-input v-model="form.newpass" :clearable="clearable" input-align="right" placeholder="请输入新密码" :type="type" @blur="newpassblur"/>
+				</u-form-item>
+			</view>
+			<p class="tishi" v-if="passisnull">请输入新密码!</p>
+			<view class="uFormbg">
+				<u-form-item label="确认新密码" left-icon="lock" :left-icon-style="lefticonstyle" label-width="200rpx" :border-bottom="borderbottom"
+				 prop="name">
+					<u-input v-model="form.newpasstwo" :clearable="clearable" input-align="right" placeholder="请再次输入新密码" :type="type" @blur="tnewpassblur"/>
+				</u-form-item>
+			</view>
+			<p class="tishi" v-if="tpassisnull">请输入新密码</p>
+			<p class="tishi" v-if="passisdif">两次输入密码不一致!</p>
+		</u-form>
+		<view class="confirm">
+			<button @click="confirm">确定</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				user_info: {},
+				form: {
+					oldpass: '',
+					newpass: '',
+					newpasstwo: ''
+				},
+				borderbottom: false,
+				clearable: false,
+				lefticonstyle: {
+					'color': '#57C878'
+				},
+				oldpassisnull:false,//旧密码为空提示
+				passisdif: false,//俩次密码不一致提示
+				tpassisnull:false,//第二次新密码为空提示
+				passisnull:false,//第一次新密码为空提示
+				type: 'password'
+			}
+		},
+		methods: {
+			clickLeft() {
+				uni.navigateTo({
+					url: './useroperation?item=' + JSON.stringify(this.user_info)
+				})
+			},
+			async changepwd(data) { //分配设备
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=user.login.changepwd',
+					data: {
+						uid: this.user_info.uid,
+						old_password: this.form.oldpass,
+						new_password: this.form.newpass,
+						confirm_password: this.form.newpasstwo
+					}
+				})
+			},
+			confirm(){//确定按钮
+			if(!(this.passisdif&&this.tpassisnull&&this.oldpassisnull&&this.passisnull)){
+					this.changepwd()
+			}
+				
+			},
+			newpassblur(){//第一次新密码框提示
+				if(this.form.newpass==""){
+					this.passisnull=true
+				}else{
+					this.passisnull=false
+				}
+			},
+			tnewpassblur(){//第二次新密码框提示
+				if(this.form.newpasstwo==""){
+					this.tpassisnull=true
+				}else{
+					this.tpassisnull=false
+					if(this.form.newpass!=this.form.newpasstwo){
+						this.passisdif=true
+					}else{
+						this.passisdif=false
+					}
+				}
+			},
+			oldpassblur(){//原始密码框提示
+				if(this.form.oldpass==""){
+					this.oldpassisnull=true
+				}else{
+					this.oldpassisnull=false
+				}
+			}
+		},
+		onLoad(option) {
+			this.user_info = JSON.parse(option.item)
+		}
+	}
+</script>
+
+<style lang="scss">
+	.uForm {
+		width: 100%;
+		position: relative;
+		top: 90rpx;
+
+		.uFormbg {
+			width: 90%;
+			background-color: #f3f3f3;
+			margin: 20rpx auto 0;
+
+			.u-form-item {
+				width: 90%;
+				padding: 10rpx 0;
+				margin: 0 auto;
+			}
+		}
+
+		.tishi {
+			width: 100%;
+			text-align: center;
+			color: red;
+			font-size: 12px;
+		}
+	}
+
+	.confirm {
+		width: 90%;
+		position: relative;
+		top: 150rpx;
+		left: 50%;
+		margin-left: -45%;
+
+		button {
+			height: 80rpx;
+			line-height: 80rpx;
+			background-color: $uni-color-success;
+			color: white;
+		}
+	}
+</style>

+ 109 - 5
pages/fourMoodBase/index/index.vue

@@ -1,6 +1,24 @@
 <template>
-	<view>
-		
+	<view class="">
+		<view class="">
+			<view style="position: fixed;z-index: 100;">
+				<uni-nav-bar @clickRight="clickRight" left-icon="back" left-text="返回" right-icon="plus" title="用户管理"></uni-nav-bar>
+			</view>
+			<view class="uinput-box">
+				<view class="uinputs">
+					<u-input v-model="argument.username" :type="type" :border="border" placeholder="请输入用户名称" input-align="center" :clearable="border"
+					 :custom-style="uinputstyle" />
+					 <u-icon name="search" class="search" size="30" @click="search"></u-icon>
+				</view>
+			</view>
+			<view class="userlists">
+				<view class="userlist-li" v-for="(item,index) in userlists" :kex="index" @click="userOperation(userlists[index])">
+					<image src="../../../static/image/fourMoodBase/touxiang.png" mode=""></image>
+					<p class="userlist-li-city">{{item.username}}</p>
+					<p class="userlist-li-eamil">{{item.mobile}}</p>
+				</view>
+			</view>
+		</view>
 	</view>
 </template>
 
@@ -8,15 +26,101 @@
 	export default {
 		data() {
 			return {
-				
+				value: '',
+				type: 'text',
+				border: false,
+				uinputstyle: {
+					"margin": "16rpx 0",
+					'background': "#f3f3f3",
+					"border-radius": "25px"
+				},
+				userlists: [],
+				argument:{
+					page:1,
+					page_size:10,
+					username:''
+				}
 			}
 		},
 		methods: {
-			
+			async getState(argument) {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=user.login.users_info',
+					data:{
+						page:argument.page,
+						page_size:argument.page_size,
+						username:argument.username
+					}
+				})
+				this.userlists =this.userlists.concat(res.data)
+			},
+			clickRight() {//跳转增加用户页面
+				uni.navigateTo({
+					url: './addusers',
+				})
+			},
+			userOperation(item) {//跳转用户信息页面
+				item=JSON.stringify(item)
+				uni.navigateTo({
+					url: './useroperation?item='+item,
+				})
+			},
+			search(){//搜索用户
+			this.userlists=[]
+				this.getState(this.argument)
+				console.log(1)
+			}
+		},//user.login.users_info
+		onLoad() {
+			this.getState(this.argument)
+		},
+		onReachBottom() {
+			this.argument.page++
+			this.getState(this.argument)
 		}
 	}
 </script>
+1
+<style lang="scss">
+	.uinput-box {
+		position: fixed;
+		top: 89rpx;
+		z-index: 100;
+		background-color: white;
+		width: 100%;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+
+		.uinputs {
+			width: 95%;
+			position: relative;
+			.search{
+				position: absolute;
+				top: 40rpx;
+				left: 200rpx;
+			}
+		}
+	}
+
+	.userlists {
+		width: 100%;
+		position: relative;
+		top: 180rpx;
 
-<style>
+		.userlist-li {
+			width: 46%;
+			height: 270rpx;
+			margin: 20rpx 0 0 20rpx;
+			float: left;
+			box-shadow: 0 0 10rpx #bcb9ca;
+			text-align: center;
 
+			image {
+				width: 80rpx;
+				height: 80rpx;
+				margin: 40rpx 0 20rpx;
+			}
+		}
+	}
 </style>

+ 372 - 0
pages/fourMoodBase/index/useroperation.vue

@@ -0,0 +1,372 @@
+<template>
+	<view class="">
+		<view style="position: fixed;z-index: 100;">
+			<uni-nav-bar left-icon="back" left-text="返回" @clickLeft="clickLeft" title="用户详情"></uni-nav-bar>
+		</view>
+		<view class="useroperations">
+			<u-form :model="user_meg" ref="uForm" class="uForm">
+				<view class="uFormbg">
+					<u-form-item label="姓名" left-icon="account" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom"
+					 prop="name">
+						<u-input v-model="user_meg.username" :clearable="clearable" input-align="right" disabled />
+					</u-form-item>
+				</view>
+				<view class="uFormbg">
+					<u-form-item label="电话" left-icon="phone" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom"
+					 prop="intro">
+						<u-input v-model="user_meg.mobile" :clearable="clearable" input-align="right" :disabled="alterTF" :class="{'uuinput':alterTF==false}" 
+						@blur="bluechange(user_meg.mobile)"/>
+					</u-form-item>
+					<p class="tishi" v-if="tishitf">手机格式错误</p>
+				</view>
+				<view class="uFormbg">
+					<u-form-item label="主题" left-icon="calendar" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom"
+					 prop="passwold">
+						<u-input v-model="theme_items" :clearable="clearable" input-align="right" :disabled="alterTF"
+						 :class="{'uuinput':alterTF==false}" type="selete" @click="theme_show = !alterTF" />
+						<u-action-sheet :list="theme" v-model="theme_show" @click="themes" scroll-y="true"></u-action-sheet>
+					</u-form-item>
+				</view>
+				<view class="uFormbg">
+					<u-form-item label="用户类型" left-icon="grid" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom">
+						<u-input v-model="users_type[user_meg.user_type-1].text" :clearable="clearable" input-align="right" disabled />
+					</u-form-item>
+				</view>
+				<view class="uFormbg">
+					<u-form-item label="用户角色" left-icon="account-fill" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom">
+						<u-input v-model="user_meg.role_name" :clearable="clearable" input-align="right" placeholder="请选择主题" :disabled="alterTF"
+						 :class="{'uuinput':alterTF==false}" @click="users_type_show = !alterTF" />
+					</u-form-item>
+				</view>
+				<view class="uFormbg">
+					<u-form-item label="是否可用" left-icon="order" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom">
+						<u-input v-model="tf" :clearable="clearable" input-align="right" disabled />
+					</u-form-item>
+				</view>
+				<view class="uFormbg">
+					<u-form-item label="创建时间" left-icon="clock" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom">
+						<u-input :clearable="clearable" input-align="right" disabled :value="user_meg.addtime|timeFormat()" />
+					</u-form-item>
+				</view>
+			</u-form>
+		</view>
+		<view class="operation_group">
+			<view class="group_one" v-if="btnTF">
+				<view class="group_one_top">
+					<button type="default" @click="recharge">充值</button>
+					<button type="default" @click="compile">编辑</button>
+					<button type="default" @click="forbidden" v-if="forbiddenTF" style="background-color: red;">禁用</button>
+					<button type="default" @click="forbidden" v-else>可用</button>
+					<button type="default" @click="changePassword">修改密码</button>
+				</view>
+				<view class="group_one_bot">
+					<button type="default" @click="assignment">分配设备</button>
+				</view>
+			</view>
+			<view class="group_two" v-else>
+				<button type="default" @click="modification" :disabled="tijiaotf">确定</button>
+			</view>
+		</view>
+		<u-popup v-model="users_type_show" mode="bottom" length="40%" class="pop-up">
+			<scroll-view scroll-y="true" class="sheet">
+				<view class="sheet-text" v-for="(item,index) in roles" :key="index">
+					<p @click="typesofroles(index)">{{item.text}}</p>
+				</view>
+			</scroll-view>
+			<button @click="users_type_show = false">取消</button>
+		</u-popup>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				user_meg: {},
+				lefticonstyle: {
+					'color': "#57C878"
+				},
+				borderbottom: false,
+				clearable: false,
+				tf: "",
+				usersofrole_show: true,
+				btnTF: true,
+				users_type: [{
+					text: '超级管理员'
+				}, {
+					text: '经销商'
+				}, {
+					text: '农林政府单位'
+				}, {
+					text: '普通用户'
+				}],
+				users_type_show: false,
+				forbiddenTF: null,
+				alterTF: true,
+				theme: [],
+				theme_show: false,
+				theme_items:'--',
+				roles: [],
+				roles_id:null,
+				tishitf:false,
+				tijiaotf:false
+			}
+		},
+		methods: {
+			async getForbidden() {//获取用户的使用状态
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=user.login.users_statu_updata',
+					data: {
+						uid: this.user_meg.uid,
+						state: this.user_meg.state == '1' ? 4 : 1 //1是正常  4是禁用
+					}
+				})
+				console.log(res)
+				if (this.user_meg.state == "1" && res == true) {
+					this.user_meg.state = '4'
+					console.log(this.user_meg.state)
+				} else {
+					this.user_meg.state = '1'
+					console.log(this.user_meg.state)
+				}
+
+				if (this.user_meg.state == '1') {
+					this.tf = "正常"
+					this.forbiddenTF = true
+				} else if (this.user_meg.state == '4') {
+					this.tf = "禁止使用"
+					this.forbiddenTF = false
+				}
+			},
+			async getGroup() {//获取用户的主题信息
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=pest.warning_record.rolemanage_view'
+				})
+				for (var i = 0; i < res.data.length; i++) {
+					let obj ={}
+					obj.text = res.data[i].role_describe
+					obj.id=res.data[i].id
+					this.theme.push(obj)
+					if(this.user_meg.user_group_id==res.data[i].id){//根据主题id更改主题
+						this.theme_items=res.data[i].role_describe
+					}
+				}
+			},
+			async getThemes() {//获取用户角色
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=user.perms.role_list'
+				})
+				for (var i = 0; i < res.length; i++) {
+					let obj ={}
+					obj.text = res[i].role_name
+					obj.id=res[i].role_id
+					this.roles.push(obj)
+				}
+			},
+			compile() {//编辑按钮
+				this.btnTF = !this.btnTF
+				this.alterTF = false
+			},
+			forbidden() {//禁用按钮
+				this.getForbidden()
+			},
+			themes(index) {//主题下拉框
+				this.theme_items = this.theme[index].text;
+				this.user_meg.user_group_id_index = this.theme[index].id;
+			},
+			async getModification() {//修改用户
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=user.login.users_info_updata',
+					data: {
+						uid: this.user_meg.uid,
+						mobile: this.user_meg.mobile,
+						user_group_id:this.user_meg.user_group_id_index || '',
+						user_type: this.user_meg.user_type,
+						role_id:this.roles_id || this.user_meg.role_id 
+					},
+				})
+			},
+			modification() {//修改用户确认按钮
+				this.getModification()
+				this.btnTF = true
+				this.alterTF = true
+			},
+			typesofroles(idnex){//主题下拉框选项按钮
+				this.user_meg.role_name = this.roles[idnex].text
+				this.users_type_show = false
+				this.roles_id=this.roles[idnex].id
+			},
+			bluechange(str){//手机号框失去焦点时检测手机号
+				let regexp=/^1[23456789]\d{9}$/
+				this.tishitf=!regexp.test(str)
+				if(regexp.test(str)){
+					this.tijiaotf=!regexp.test(str)
+				}else{
+					this.tijiaotf=regexp.test(str)
+				}
+				
+			},
+			clickLeft(){//返回上一页按钮
+				uni.navigateTo({
+				    url: './index'
+				});
+			},
+			changePassword(){//修改密码
+				uni.navigateTo({
+				    url: './changepasswold?item='+JSON.stringify(this.user_meg)
+				});
+			},
+			assignment(){//分配设备
+				uni.navigateTo({
+				    url: './assignment?item='+JSON.stringify(this.user_meg)
+				});
+			},
+			async getRecharge() {//修改用户
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=user.login.user_add_package_time',
+					data: {
+						uid: this.user_meg.uid,
+						user_test:1
+					},
+				})
+			},
+			recharge(){//充值按钮
+				uni.showModal({
+				    title: '提示',
+				    content: '是否向该用户充值一年费用?',
+				    success: function (res) {
+				        if (res.confirm) {
+							this.getRecharge()
+				            console.log('用户点击确定');
+				        } else if (res.cancel) {
+				            console.log('用户点击取消');
+				        }
+				    }
+				});
+			}
+		},
+		onLoad(option) {
+			this.user_meg = JSON.parse(option.item)
+			console.log(this.user_meg)
+			if (this.user_meg.state == '1') {
+				this.tf = "正常"
+				this.forbiddenTF = true
+			} else if (this.user_meg.state == '4') {
+				this.tf = "禁止使用"
+				this.forbiddenTF = false
+			}
+			this.getGroup()
+			this.getThemes()
+		}
+	}
+</script>
+
+<style lang="scss">
+	.useroperations {
+		width: 100%;
+		display: flex;
+		justify-content: center;
+
+		.uForm {
+			margin-top: 88rpx;
+			width: 95%;
+
+			.uFormbg {
+				width: 100%;
+				background-color: #f3f3f3;
+				margin-top: 20rpx;
+			}
+			.tishi{
+				text-align: center;
+				font-size: 24rpx;
+				color: red;
+			}
+			.u-form-item {
+				width: 95%;
+				height: 80rpx;
+				margin: 0 auto;
+				padding: 5rpx 0;
+			}
+
+			.uuinput {
+				background-color: white;
+			}
+		}
+	}
+
+	.operation_group {
+		.group_one {
+			.group_one_top {
+				width: 90%;
+				margin: 20rpx auto;
+				display: flex;
+				justify-content: space-around;
+
+				button {
+					width: 23%;
+					height: 60rpx;
+					line-height: 60rpx;
+					background-color: $uni-color-success;
+					color: white;
+					font-size: 24rpx;
+				}
+			}
+
+			.group_one_bot {
+				width: 90%;
+				margin: 20rpx auto;
+
+				button {
+					height: 60rpx;
+					line-height: 60rpx;
+					background-color: $uni-color-success;
+					color: white;
+					font-size: 30rpx;
+				}
+			}
+		}
+
+		.group_two {
+			width: 90%;
+			margin: 20rpx auto;
+
+			button {
+				background-color: $uni-color-success;
+				color: white;
+				height: 80rpx;
+				line-height: 80rpx;
+				font-size: 30rpx;
+			}
+		}
+
+	}
+	.pop-up {
+		.sheet {
+			background-color: white;
+			height: 400rpx;
+			overflow: hidden;
+	
+			.sheet-text {
+				height: 80rpx;
+	
+				p {
+					text-align: center;
+					height: 80rpx;
+					line-height: 80rpx;
+					color: black;
+					font-size: 16px;
+				}
+			}
+	
+		}
+	
+		button {
+			color: black;
+			position: absolute;
+			bottom: 0;
+			width: 100%;
+			font-size: 16px;
+			height: 80rpx;
+		}
+	}
+</style>

BIN
static/image/fourMoodBase/touxiang.png


BIN
static/image/fourMoodBase/孢子仪.png


BIN
static/image/fourMoodBase/性诱测报.png


BIN
static/image/fourMoodBase/杀虫灯.png


BIN
static/image/fourMoodBase/测报灯.png


BIN
static/image/fourMoodBase/环境监测.png


BIN
static/image/fourMoodBase/监控.png