|
@@ -5,41 +5,56 @@
|
|
|
</view>
|
|
</view>
|
|
|
<view class="addusers">
|
|
<view class="addusers">
|
|
|
<u-form :model="form" ref="uForm" class="uForm">
|
|
<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>
|
|
|
|
|
|
|
+ <view class="uFormbg">
|
|
|
|
|
+ <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>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="uFormbg">
|
|
|
|
|
+ <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>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="uFormbg">
|
|
|
|
|
+ <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>
|
|
|
|
|
+ </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="form.typesofrole" type="select" :clearable="clearable" @click="typesofrole[0].show = true"
|
|
|
|
|
+ input-align="right" placeholder="请选择角色类型" :select-open="typesofrole[0].show"/>
|
|
|
|
|
+ </u-form-item>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="uFormbg">
|
|
|
|
|
+ <u-form-item label="主题" left-icon="calendar" :left-icon-style="lefticonstyle" label-width="160rpx" :border-bottom="borderbottom">
|
|
|
|
|
+ <u-input v-model="form.theme" :clearable="clearable" type="select" @click="theme_show = true" input-align="right" placeholder="请选择主题"
|
|
|
|
|
+ :select-open="theme_show"/>
|
|
|
|
|
+ <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="form.usersofrole" type="select" :clearable="clearable" @click="usersofrole_show = true"
|
|
|
|
|
+ input-align="right" :placeholder="usersofrole[0].text" :select-open="usersofrole_show"/>
|
|
|
|
|
+ <u-action-sheet :list="usersofrole" v-model="usersofrole_show" @click="usersofroles"></u-action-sheet>
|
|
|
|
|
+ </u-form-item>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="uFormbg">
|
|
|
|
|
+ <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" :select-open="testuser_show" />
|
|
|
|
|
+ <u-action-sheet :list="testuser" v-model="testuser_show" @click="testusers"></u-action-sheet>
|
|
|
|
|
+ </u-form-item>
|
|
|
|
|
+ </view>
|
|
|
</u-form>
|
|
</u-form>
|
|
|
</view>
|
|
</view>
|
|
|
<button class="submitbtn" @click="addusers">确 定</button>
|
|
<button class="submitbtn" @click="addusers">确 定</button>
|
|
|
- <u-popup v-model="typesofrole[0].show" mode="bottom" length="40%" class="pop-up">
|
|
|
|
|
|
|
+ <u-popup v-model="typesofrole[0].show" mode="bottom" length="30%" class="pop-up">
|
|
|
<scroll-view scroll-y="true" class="sheet">
|
|
<scroll-view scroll-y="true" class="sheet">
|
|
|
<view class="sheet-text" v-for="(item,index) in typesofrole[1]" :key="index">
|
|
<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>
|
|
<p @click="typesofroles(item.role_name,item.role_id)">{{item.role_name}}</p>
|
|
@@ -66,7 +81,7 @@
|
|
|
typesofrole_id: null,
|
|
typesofrole_id: null,
|
|
|
theme: null,
|
|
theme: null,
|
|
|
usersofrole: null,
|
|
usersofrole: null,
|
|
|
- usersofrole_id:null,
|
|
|
|
|
|
|
+ usersofrole_id: null,
|
|
|
testuser: null,
|
|
testuser: null,
|
|
|
},
|
|
},
|
|
|
rules: {
|
|
rules: {
|
|
@@ -80,7 +95,7 @@
|
|
|
validator: (rule, value, callback) => {
|
|
validator: (rule, value, callback) => {
|
|
|
// 上面有说,返回true表示校验通过,返回false表示不通过
|
|
// 上面有说,返回true表示校验通过,返回false表示不通过
|
|
|
// this.$u.test.mobile()就是返回true或者false的
|
|
// this.$u.test.mobile()就是返回true或者false的
|
|
|
- return value.length<10 && value.length>1
|
|
|
|
|
|
|
+ return value.length < 10 && value.length > 1
|
|
|
},
|
|
},
|
|
|
message: '请输入2-10个字符',
|
|
message: '请输入2-10个字符',
|
|
|
// 触发器可以同时用blur和change
|
|
// 触发器可以同时用blur和change
|
|
@@ -137,9 +152,9 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- typesofroles(value,id) {
|
|
|
|
|
|
|
+ typesofroles(value, id) {
|
|
|
this.form.typesofrole = value;
|
|
this.form.typesofrole = value;
|
|
|
- this.form.typesofrole_id=id
|
|
|
|
|
|
|
+ this.form.typesofrole_id = id
|
|
|
this.typesofrole[0].show = false
|
|
this.typesofrole[0].show = false
|
|
|
},
|
|
},
|
|
|
themes(index) {
|
|
themes(index) {
|
|
@@ -147,7 +162,7 @@
|
|
|
},
|
|
},
|
|
|
usersofroles(index) {
|
|
usersofroles(index) {
|
|
|
this.form.usersofrole = this.usersofrole[index].text;
|
|
this.form.usersofrole = this.usersofrole[index].text;
|
|
|
- this.form.usersofrole_id=index+1
|
|
|
|
|
|
|
+ this.form.usersofrole_id = index + 1
|
|
|
},
|
|
},
|
|
|
testusers(index) {
|
|
testusers(index) {
|
|
|
this.form.testuser = this.testuser[index].text;
|
|
this.form.testuser = this.testuser[index].text;
|
|
@@ -164,37 +179,37 @@
|
|
|
url: '/api/api_gateway?method=pest.warning_record.rolemanage_view'
|
|
url: '/api/api_gateway?method=pest.warning_record.rolemanage_view'
|
|
|
})
|
|
})
|
|
|
console.log(res.data)
|
|
console.log(res.data)
|
|
|
- for (var i=0;i<res.data.length;i++) {
|
|
|
|
|
|
|
+ for (var i = 0; i < res.data.length; i++) {
|
|
|
let obj = {}
|
|
let obj = {}
|
|
|
obj.text = res.data[i].role_describe
|
|
obj.text = res.data[i].role_describe
|
|
|
- obj.role_id=res.data[i].id
|
|
|
|
|
|
|
+ obj.role_id = res.data[i].id
|
|
|
this.theme.push(obj)
|
|
this.theme.push(obj)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
async getaddusers() {
|
|
async getaddusers() {
|
|
|
const res = await this.$myRequest({
|
|
const res = await this.$myRequest({
|
|
|
url: '/api/api_gateway?method=user.login.regiest',
|
|
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
|
|
|
|
|
|
|
+ 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){
|
|
|
|
|
|
|
+ addusers() {
|
|
|
|
|
+ if (this.form.name && this.form.intro && this.form.passwold) {
|
|
|
this.getaddusers()
|
|
this.getaddusers()
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
- url: './index'
|
|
|
|
|
|
|
+ url: './index'
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- clickLeft(){
|
|
|
|
|
|
|
+ clickLeft() {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
- url: './index'
|
|
|
|
|
|
|
+ url: './index'
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -216,7 +231,19 @@
|
|
|
|
|
|
|
|
.uForm {
|
|
.uForm {
|
|
|
margin-top: 88rpx;
|
|
margin-top: 88rpx;
|
|
|
- width: 85%;
|
|
|
|
|
|
|
+ width: 90%;
|
|
|
|
|
+
|
|
|
|
|
+ .uFormbg {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ padding: 0 20rpx;
|
|
|
|
|
+ margin: 20rpx 0;
|
|
|
|
|
+ background-color: #F7F8FA;
|
|
|
|
|
+
|
|
|
|
|
+ .u-form-item {
|
|
|
|
|
+ padding: 0 10rpx;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|