|
@@ -28,7 +28,10 @@ Page({
|
|
|
class_:-1,
|
|
|
class_id:0,
|
|
|
data:{},
|
|
|
- type:0
|
|
|
+ type:0,
|
|
|
+ device_cats:[],
|
|
|
+ dev:[],
|
|
|
+ show_dev:false
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -47,8 +50,7 @@ Page({
|
|
|
},
|
|
|
success: res => {
|
|
|
user = res.data.data
|
|
|
- console.log(user)
|
|
|
- if(options.type != 2){
|
|
|
+ if (options.type != 2 && user){
|
|
|
this.setData({
|
|
|
name:user.name,
|
|
|
company: user.company,
|
|
@@ -97,7 +99,6 @@ Page({
|
|
|
let list = sub_list.filter(item => item.name == subject_item[0]);
|
|
|
let categoryArray = list[0].children, subject = 0,
|
|
|
subjectArray = [], category = 0, train=0;
|
|
|
-
|
|
|
//定位分类下拉选项
|
|
|
for(let i=0;i<categoryArray.length;i++){
|
|
|
if (categoryArray[i].name == subject_item[1]){
|
|
@@ -120,7 +121,7 @@ Page({
|
|
|
url: host + '/api/wx/class/list?subject_item0=' + list[0].name,
|
|
|
method: 'GET',
|
|
|
success: res => {
|
|
|
- let classes = res.data.data, class_=0
|
|
|
+ let classes = res.data.data[0].classes, class_=0
|
|
|
for(let i=0;i<classes.length;i++){
|
|
|
if (classes[i].cid == data.class_id){
|
|
|
class_=i
|
|
@@ -142,8 +143,9 @@ Page({
|
|
|
category: category,
|
|
|
subject: subject,
|
|
|
train: train,
|
|
|
- area:data.area.split(' ')
|
|
|
-
|
|
|
+ area:data.area.split(' '),
|
|
|
+ device_cats: categoryArray[category].device_cats,
|
|
|
+ dev: data.device_cats ? data.device_cats.join(' , '):''
|
|
|
})
|
|
|
|
|
|
this.setData({
|
|
@@ -163,6 +165,32 @@ Page({
|
|
|
})
|
|
|
|
|
|
},
|
|
|
+ sure:function(){
|
|
|
+ if(this.data.dev==''){
|
|
|
+ wx.showToast({
|
|
|
+ title: '请选择设备种类!',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ show_dev: false,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ checkboxChange:function(e){
|
|
|
+ console.log('checkbox发生change事件,携带value值为:', e.detail.value)
|
|
|
+ const values = e.detail.value
|
|
|
+ this.setData({
|
|
|
+ dev: e.detail.value.join(' , ')
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ open:function(){
|
|
|
+ this.setData({
|
|
|
+ show_dev: true,
|
|
|
+ })
|
|
|
+ },
|
|
|
pickerChange:function(e){
|
|
|
if(e.target.dataset.name == 'sex'){
|
|
|
this.setData({
|
|
@@ -180,8 +208,15 @@ Page({
|
|
|
category: e.detail.value,
|
|
|
subjectArray: list,
|
|
|
subject:-1,
|
|
|
- train:-1
|
|
|
+ train:-1,
|
|
|
+ device_cats: this.data.categoryArray[e.detail.value].device_cats,
|
|
|
+ dev: ''
|
|
|
})
|
|
|
+ if (this.data.categoryArray[e.detail.value].device_cats.length>0){
|
|
|
+ this.setData({
|
|
|
+ show_dev: true
|
|
|
+ })
|
|
|
+ }
|
|
|
};
|
|
|
if (e.target.dataset.name == 'subject') {
|
|
|
this.setData({
|
|
@@ -233,6 +268,9 @@ Page({
|
|
|
},
|
|
|
next:function(e){
|
|
|
var formData = e.detail.value,data=this.data
|
|
|
+ if (this.data.dev != ''){
|
|
|
+ formData.device_cats = this.data.dev.split(' , ')
|
|
|
+ }
|
|
|
if (formData.name == '') {
|
|
|
wx.showToast({
|
|
|
title: '姓名不能为空!',
|
|
@@ -274,9 +312,9 @@ Page({
|
|
|
})
|
|
|
return false
|
|
|
}
|
|
|
- console.log(this.data.class_)
|
|
|
- console.log(this.data.z_type)
|
|
|
- if (this.data.class_ == -1&&this.data.z_type != '特种作业人员') {
|
|
|
+ // console.log(this.data.class_)
|
|
|
+ // console.log(this.data.z_type)
|
|
|
+ if (this.data.classList.length>0&&this.data.class_ == -1&&this.data.z_type != '特种作业人员') {
|
|
|
wx.showToast({
|
|
|
title: '请选择班级',
|
|
|
icon: 'none',
|