init version kelfy-mini for new gitea
This commit is contained in:
818
pages/studentMsgDel/studentMsgDel.js
Normal file
818
pages/studentMsgDel/studentMsgDel.js
Normal file
@@ -0,0 +1,818 @@
|
||||
const util = require('../../utils/util.js');
|
||||
const api = require('../../config/api.js');
|
||||
const user = require('../../utils/user.js');
|
||||
|
||||
//获取应用实例
|
||||
const app = getApp();
|
||||
//var app = getApp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
//默认为0,从根节点开始
|
||||
parentid: 0,
|
||||
//学生归属的学校id
|
||||
deptid: 0,
|
||||
|
||||
//班级选择
|
||||
classxpList:[],
|
||||
classxpListBackup: [],
|
||||
classIndexes: '',
|
||||
classcurrent: '',
|
||||
classSwitch: false,
|
||||
//学校选择
|
||||
schoolxpList:[],
|
||||
schoolxpListBackup: [],
|
||||
schoolIndexes: '',
|
||||
schoolcurrent: '',
|
||||
schoolSwitch: false,
|
||||
|
||||
//体检部门信息
|
||||
schoolname: '',
|
||||
classname: '',
|
||||
studentname: '',
|
||||
xytjinfo: {
|
||||
jdid: '',
|
||||
jdname: '',
|
||||
sqid: '',
|
||||
sqname: '',
|
||||
schoolid: '',
|
||||
schoolname: '',
|
||||
classid: '',
|
||||
classname: ''
|
||||
},
|
||||
|
||||
// show:false,
|
||||
// show2:false,
|
||||
// show3:false,
|
||||
showsex: false,
|
||||
relateSex:[
|
||||
{name:'男',value:'1'},
|
||||
{name:'女',value:'2'},
|
||||
],
|
||||
// relate:[
|
||||
// {name:'本人',relate:'0'},
|
||||
// {name:'子女',relate:'1'},
|
||||
// {name:'夫妻',relate:'2'},
|
||||
// {name:'父母',relate:'3'},
|
||||
// {name:'朋友',relate:'4'},
|
||||
// ],
|
||||
// cardType: [
|
||||
// // { name: '病历卡', value: 0 },
|
||||
// { name: '就诊卡', value: 1 ,msg:"请输入就诊卡号"},
|
||||
// // { name: '保障卡', value: 3 },
|
||||
// { name: '社保卡', value: 1 ,msg:'请输入社保卡号'},
|
||||
// { name: '身份证(电子健康卡)', value: 4 ,msg:'请输入身份证号码'},
|
||||
// ],
|
||||
state:'',//新增编辑状态
|
||||
type:'',//是否默认
|
||||
checked: '',//默认按钮选中状态
|
||||
idCard:'',//身份证
|
||||
trueName:'',//姓名
|
||||
sex: '', //性别
|
||||
sexdisp: '', //性别显示
|
||||
age: '', //年龄
|
||||
id: 0, //学生表主键id
|
||||
xschoolname: '',
|
||||
xclassname: '',
|
||||
xclassid: '',
|
||||
|
||||
sfzList:[],
|
||||
msg:"请输入号码",
|
||||
relateNmae:'',//关系名
|
||||
relateId:'',//关系值
|
||||
carNum:'',//就诊卡
|
||||
title:'',//标题
|
||||
cardT:'',//证件类型
|
||||
disabled:'',
|
||||
zjh:'',//证件号
|
||||
usrPatid:'' //学生就诊卡
|
||||
},
|
||||
|
||||
showPopSex(){
|
||||
this.setData({ showsex: true });
|
||||
},
|
||||
|
||||
onCloseSex(){
|
||||
this.setData({ showsex: false });
|
||||
},
|
||||
|
||||
confirmSex(e){
|
||||
console.log(e.currentTarget.dataset.item)
|
||||
let item = e.currentTarget.dataset.item
|
||||
this.setData({
|
||||
sex : item.value,
|
||||
sexdisp: item.name,
|
||||
showsex: false
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
onChange({ detail }) {
|
||||
this.setData({ checked: detail });
|
||||
},
|
||||
del(){
|
||||
var userid = 0;
|
||||
userid = this.data.id;
|
||||
|
||||
wx.showModal({
|
||||
title: '',
|
||||
content: '确定删除此体检人信息吗?',
|
||||
cancelText:"否",
|
||||
confirmText:'是',
|
||||
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
util.requestForm(api.deletestudent, {
|
||||
id: userid
|
||||
}, "DELETE")
|
||||
.then(function(res) {
|
||||
if (res.code === 0) {
|
||||
console.log("deletestudent res:");
|
||||
console.log(res);
|
||||
console.log("deletestudent resdata:");
|
||||
console.log(res.data);
|
||||
|
||||
wx.showToast({
|
||||
title: '删除成功',
|
||||
icon:'success'
|
||||
})
|
||||
setTimeout(item => {
|
||||
wx.navigateBack({
|
||||
delta: 1 //返回上一级页面
|
||||
})
|
||||
},1000)
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
save(){
|
||||
//是否默认体检人
|
||||
if(this.data.checked == true){
|
||||
this.setData({
|
||||
type:0
|
||||
})
|
||||
}else{
|
||||
this.setData({
|
||||
type:1
|
||||
})
|
||||
}
|
||||
|
||||
// let relate = this.data.relateId
|
||||
// let cardType = this.data.cardV
|
||||
// let medical_card = this.data.carNum
|
||||
let that = this;
|
||||
let cardNum = this.data.idCard
|
||||
let type = this.data.type
|
||||
let hzxm =this.data.trueName
|
||||
let sex = this.getSexFromIdCard(this.data.idCard)
|
||||
let age = this.calculateAge(this.data.idCard)
|
||||
let userid = this.data.id;
|
||||
let classid = this.data.xytjinfo.classid;
|
||||
let classname = this.data.xytjinfo.classname;
|
||||
let schoolname = this.data.xytjinfo.schoolname;
|
||||
|
||||
console.log(hzxm)
|
||||
console.log(cardNum)
|
||||
console.log(type)
|
||||
console.log(sex)
|
||||
console.log(age)
|
||||
console.log(this.data.state)
|
||||
|
||||
//state 0 -- 新增
|
||||
if(this.data.state == 0){
|
||||
if(cardNum ==''){
|
||||
wx.showModal({
|
||||
content: '请填写完整身份证号码',
|
||||
showCancel: false,
|
||||
})
|
||||
}else{
|
||||
util.requestPost(api.createstudent, {
|
||||
openid: app.globalData.openId,
|
||||
defaultflag: type,
|
||||
name: hzxm,
|
||||
sex: sex,
|
||||
age: age,
|
||||
deptId: classid,
|
||||
className: classname,
|
||||
schoolName: schoolname,
|
||||
nationId: cardNum
|
||||
})
|
||||
.then(function(res) {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
console.log("createstudent res:");
|
||||
console.log(res);
|
||||
console.log("createstudent resdata:");
|
||||
console.log(res.data);
|
||||
|
||||
if(type == 0)
|
||||
{
|
||||
app.globalData.gdefaultflag = type;
|
||||
app.globalData.gname = hzxm;
|
||||
app.globalData.gsex = sex;
|
||||
app.globalData.gage = age;
|
||||
app.globalData.gdeptId = classid;
|
||||
app.globalData.gclassName = classname;
|
||||
app.globalData.gschoolName = schoolname;
|
||||
app.globalData.gnationId = cardNum;
|
||||
}
|
||||
|
||||
//自动建档并关联到父openid
|
||||
that.linkUser(hzxm, cardNum);
|
||||
|
||||
wx.showToast({
|
||||
title: '添加成功',
|
||||
icon:'success'
|
||||
})
|
||||
setTimeout(item => {
|
||||
wx.navigateBack({
|
||||
delta: 1 //返回上一级页面
|
||||
})
|
||||
},1000)
|
||||
|
||||
}
|
||||
else{
|
||||
wx.showToast({
|
||||
title: res.msg,
|
||||
icon:'error'
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}else{
|
||||
|
||||
//如果已经是默认体检人,不允许改变,需要先设置其他人为默认
|
||||
console.log("默认 体检人");
|
||||
console.log(app.globalData.gnationId);
|
||||
if(type == 1 && (app.globalData.gnationId === cardNum) ){
|
||||
wx.showModal({
|
||||
content: '至少一个人为默认体检人',
|
||||
showCancel: false,
|
||||
})
|
||||
}else{
|
||||
wx.showModal({
|
||||
title: '',
|
||||
content: '确定更改此体检人信息吗?',
|
||||
cancelText:"否",
|
||||
confirmText:'是',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
|
||||
util.requestPost(api.updatestudent, {
|
||||
openid: app.globalData.openId,
|
||||
defaultflag: type,
|
||||
name: hzxm,
|
||||
sex: sex,
|
||||
nationId: cardNum,
|
||||
id: userid,
|
||||
deptId: classid,
|
||||
className: classname,
|
||||
schoolName: schoolname,
|
||||
age: age
|
||||
})
|
||||
.then(function(res) {
|
||||
if (res.code === 0) {
|
||||
console.log("updatestudent res:");
|
||||
console.log(res);
|
||||
console.log("updatestudent resdata:");
|
||||
console.log(res.data);
|
||||
|
||||
console.log(hzxm)
|
||||
console.log(cardNum)
|
||||
console.log(type)
|
||||
console.log(sex)
|
||||
console.log(age)
|
||||
|
||||
if(type == 0){
|
||||
app.globalData.gdefaultflag = type;
|
||||
app.globalData.gname = hzxm;
|
||||
app.globalData.gsex = sex;
|
||||
app.globalData.gage = age;
|
||||
app.globalData.gdeptId = classid;
|
||||
app.globalData.gclassName = classname;
|
||||
app.globalData.gschoolName = schoolname;
|
||||
app.globalData.gnationId = cardNum;
|
||||
}
|
||||
wx.showToast({
|
||||
title: '编辑成功',
|
||||
icon:'success'
|
||||
})
|
||||
setTimeout(item => {
|
||||
wx.navigateBack({
|
||||
delta: 1 //返回上一级页面
|
||||
})
|
||||
},1000)
|
||||
|
||||
}
|
||||
else{
|
||||
wx.showToast({
|
||||
title: res.msg,
|
||||
icon:'error'
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
linkUser:function(gname, xPatid){
|
||||
//第二步 关联到父openid
|
||||
console.log(xPatid, 'usrPatid');
|
||||
wx.request({
|
||||
url:'https://fy.btlsoln.com:8443/patientBindWXUser?cardno&cardtype&openid&relate&type&hzxm',
|
||||
method:"GET",
|
||||
data:{
|
||||
cardno: xPatid,
|
||||
cardtype: '1',
|
||||
relate: '1', //都是子女
|
||||
type: '1', //不当做默认就诊人
|
||||
openid: app.globalData.openId,
|
||||
hzxm: gname
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res)=> {
|
||||
if(res.data.errCode == 0){
|
||||
wx.showToast({
|
||||
title: '关联就诊人成功',
|
||||
icon:'success'
|
||||
})
|
||||
return true;
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: "关联就诊人失败",
|
||||
icon:'error'
|
||||
})
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
checkUser(gname, gnationId){
|
||||
let that = this;
|
||||
//查档
|
||||
wx.request({
|
||||
url:'https://fy.btlsoln.com:8443/his/getPatient?cardno&cardtype&hzxm',
|
||||
method:"GET",
|
||||
data:{
|
||||
cardno: gnationId,
|
||||
cardtype: '4', //只支持身份证建档
|
||||
hzxm: gname
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res)=> {
|
||||
if(res.data.errCode == 0){
|
||||
console.log(res.data,'exist user')
|
||||
console.log(res.data.list[0].brzt,'exist user')
|
||||
if(res.data.list[0].brzt == 'R'){
|
||||
//需要建档
|
||||
//第一步 先做身份证建档
|
||||
console.log("开始建档");
|
||||
util.requestForm(api.addUser, {
|
||||
hzxm: gname,
|
||||
sfzh: gnationId,
|
||||
lxdh: ''
|
||||
})
|
||||
.then(function(res) {
|
||||
console.log(res, 'adduser res');
|
||||
if (res.errCode == 0) {
|
||||
console.log(res.list[0].patid, 'patid');
|
||||
|
||||
that.setData({
|
||||
usrPatid: res.list[0].patid
|
||||
})
|
||||
wx.showToast({
|
||||
title: '自动建档成功',
|
||||
icon:'success'
|
||||
})
|
||||
// that.linkUser(gname, res.list[0].patid);
|
||||
|
||||
that.linkUser(gname, gnationId);
|
||||
}
|
||||
else{
|
||||
wx.showToast({
|
||||
title: res.errMsg,
|
||||
icon:'error'
|
||||
})
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
//已经建档
|
||||
// that.linkUser(gname, res.data.list[0].patid);
|
||||
that.linkUser(gname, gnationId);
|
||||
}
|
||||
}else{
|
||||
console.log(res.data,'error for check user')
|
||||
}
|
||||
},
|
||||
fail: (res)=> {
|
||||
console.log(res.data,'exception for check user')
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
showModal(error) {
|
||||
wx.showModal({
|
||||
content: error.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
},
|
||||
trueName:function(e){
|
||||
this.setData({
|
||||
trueName:e.detail.value
|
||||
})
|
||||
},
|
||||
change_trueName(e){
|
||||
let hzxm =e.detail.value.replace(/\./g,'·')
|
||||
hzxm =hzxm.replace(/\。/g,'·')
|
||||
this.setData({
|
||||
trueName:hzxm
|
||||
})
|
||||
},
|
||||
zjh:function(e){
|
||||
this.setData({
|
||||
zjh:e.detail.value
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
// url: '/pages/studentMsgDel/studentMsgDel?state='+state+'&idCard='+idCard+'&trueName='+trueName+'&type='+type +'&sex='+sex +'&age='+age+'&state='+state,
|
||||
console.log(options,"编辑")
|
||||
this.setData({
|
||||
state:options.state,
|
||||
id: options.id
|
||||
})
|
||||
|
||||
if(options.sex == 1){
|
||||
this.setData({
|
||||
sexdisp: '男'
|
||||
})
|
||||
}else if(options.sex == 2){
|
||||
this.setData({
|
||||
sexdisp: '女'
|
||||
})
|
||||
}
|
||||
|
||||
if(options.type == 0){
|
||||
this.setData({
|
||||
checked:true,
|
||||
type: 0
|
||||
})
|
||||
}else {
|
||||
this.setData({
|
||||
checked:false,
|
||||
type: 1
|
||||
})
|
||||
}
|
||||
if(options.state == 0){
|
||||
this.setData({
|
||||
title:"添加体检人"
|
||||
})
|
||||
}else{
|
||||
this.setData({
|
||||
title:"编辑体检人",
|
||||
trueName:options.trueName,
|
||||
idCard:options.idCard,
|
||||
sex:options.sex,
|
||||
age:options.age,
|
||||
id: options.id,
|
||||
schoolname: options.schoolname,
|
||||
classname: options.classname,
|
||||
disabled:"disabled"
|
||||
})
|
||||
}
|
||||
|
||||
//设置值
|
||||
this.data.xytjinfo.schoolname = options.schoolname;
|
||||
this.data.xytjinfo.classname = options.classname;
|
||||
this.data.xytjinfo.classid = options.classid;
|
||||
this.schoolList();
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
wx.setNavigationBarTitle({
|
||||
title: this.data.title
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
|
||||
//班级
|
||||
classList: function() {
|
||||
var that = this;
|
||||
util.request(api.deptinfo, {
|
||||
parentid: this.data.parentid
|
||||
})
|
||||
.then(function(res) {
|
||||
if (res.code === 0) {
|
||||
console.log("classinfo res:");
|
||||
console.log(res);
|
||||
console.log("classinfo resdata:");
|
||||
console.log(res.data);
|
||||
that.setData({
|
||||
classxpList: res.data,
|
||||
classxpListBackup: res.data
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
//开启控件
|
||||
classOn: function(){
|
||||
this.setData({
|
||||
classSwitch: true
|
||||
})
|
||||
},
|
||||
//关闭控件
|
||||
classShutdown: function(){
|
||||
let List = [];
|
||||
this.setData({
|
||||
classSwitch: false
|
||||
})
|
||||
//恢复数据
|
||||
for(let i = 0;i < this.data.classxpListBackup.length;i++){
|
||||
List.push(this.data.classxpListBackup[i]);
|
||||
}
|
||||
this.setData({
|
||||
classxpList: List,
|
||||
classIndexes: ''
|
||||
})
|
||||
|
||||
},
|
||||
//条件输入事件
|
||||
setclassIndexes(event){
|
||||
this.setData({
|
||||
classIndexes: event.detail,
|
||||
});
|
||||
console.log("classIndexes:" + event.detail)
|
||||
},
|
||||
//点击确定搜索时触发事件
|
||||
classGo: function(){
|
||||
wx.showToast({
|
||||
title: '加载中',
|
||||
icon: "loading",
|
||||
duration: 1000
|
||||
})
|
||||
let row = [];
|
||||
if(this.data.classIndexes){
|
||||
this.data.classxpListBackup.forEach((item) => {
|
||||
if (item.name.indexOf(this.data.classIndexes) > -1) {
|
||||
row.push(item);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
row = this.data.classxpListBackup
|
||||
}
|
||||
this.setData({
|
||||
classcurrent: this.data.classIndexes,
|
||||
classxpList: row
|
||||
})
|
||||
},
|
||||
//用户选择某个选项后触发事件
|
||||
classIdentification(event){
|
||||
let List = [];
|
||||
let Backups = this.data.classxpListBackup;
|
||||
let id = event.detail.value.id;
|
||||
console.log("pick select value:");
|
||||
console.log(event.detail.value);
|
||||
console.log("pick select id:" + event.detail.index);
|
||||
|
||||
this.data.xytjinfo.classid = event.detail.value.id;
|
||||
this.data.xytjinfo.classname = event.detail.value.name;
|
||||
this.setData({ classname: event.detail.value.name });
|
||||
//根据选择的id,获取下一级结构
|
||||
// this.setData({ deptid: event.detail.value.id});
|
||||
// this.studentList();
|
||||
|
||||
console.log("set select classid:" + this.data.xytjinfo.classid);
|
||||
console.log("set select classname:" + this.data.xytjinfo.classname);
|
||||
|
||||
for(let i = 0;i < Backups.length;i++){
|
||||
List.push(Backups[i]);
|
||||
}
|
||||
this.setData({
|
||||
classxpList: List,
|
||||
})
|
||||
|
||||
console.log("pick after list:");
|
||||
console.log(this.data.classxpList);
|
||||
console.log("pick after list backup");
|
||||
console.log(this.data.classxpListBackup);
|
||||
this.classShutdown();
|
||||
},
|
||||
//学校
|
||||
schoolList: function() {
|
||||
var that = this;
|
||||
util.request(api.deptinfo, {
|
||||
parentid: this.data.parentid
|
||||
})
|
||||
.then(function(res) {
|
||||
if (res.code === 0) {
|
||||
console.log("schoolinfo res:");
|
||||
console.log(res);
|
||||
console.log("schoolinfo resdata:");
|
||||
console.log(res.data);
|
||||
that.setData({
|
||||
schoolxpList: res.data,
|
||||
schoolxpListBackup: res.data
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
//开启控件
|
||||
schoolOn: function(){
|
||||
this.setData({
|
||||
schoolSwitch: true
|
||||
})
|
||||
},
|
||||
//关闭控件
|
||||
schoolShutdown: function(){
|
||||
let List = [];
|
||||
this.setData({
|
||||
schoolSwitch: false
|
||||
})
|
||||
//恢复数据
|
||||
for(let i = 0;i < this.data.schoolxpListBackup.length;i++){
|
||||
List.push(this.data.schoolxpListBackup[i]);
|
||||
}
|
||||
this.setData({
|
||||
schoolxpList: List,
|
||||
schoolIndexes: ''
|
||||
})
|
||||
|
||||
},
|
||||
//条件输入事件
|
||||
setschoolIndexes(event){
|
||||
this.setData({
|
||||
schoolIndexes: event.detail,
|
||||
});
|
||||
console.log("schoolIndexes:" + event.detail)
|
||||
},
|
||||
//点击确定搜索时触发事件
|
||||
schoolGo: function(){
|
||||
wx.showToast({
|
||||
title: '加载中',
|
||||
icon: "loading",
|
||||
duration: 1000
|
||||
})
|
||||
let row = [];
|
||||
if(this.data.schoolIndexes){
|
||||
this.data.schoolxpListBackup.forEach((item) => {
|
||||
if (item.name.indexOf(this.data.schoolIndexes) > -1) {
|
||||
row.push(item);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
row = this.data.schoolxpListBackup
|
||||
}
|
||||
this.setData({
|
||||
schoolcurrent: this.data.schoolIndexes,
|
||||
schoolxpList: row
|
||||
})
|
||||
},
|
||||
//用户选择某个选项后触发事件
|
||||
schoolIdentification(event){
|
||||
let List = [];
|
||||
let Backups = this.data.schoolxpListBackup;
|
||||
let id = event.detail.value.id;
|
||||
console.log("pick select value:");
|
||||
console.log(event.detail.value);
|
||||
console.log("pick select id:" + event.detail.index);
|
||||
|
||||
this.data.xytjinfo.schoolid = event.detail.value.id;
|
||||
this.data.xytjinfo.schoolname = event.detail.value.name;
|
||||
this.setData({ schoolname: event.detail.value.name });
|
||||
//根据选择的id,获取下一级结构
|
||||
this.setData({ parentid: event.detail.value.id});
|
||||
this.classList();
|
||||
|
||||
console.log("set select schoolid:" + this.data.xytjinfo.schoolid);
|
||||
console.log("set select schoolname:" + this.data.xytjinfo.schoolname);
|
||||
|
||||
for(let i = 0;i < Backups.length;i++){
|
||||
List.push(Backups[i]);
|
||||
}
|
||||
this.setData({
|
||||
schoolxpList: List,
|
||||
})
|
||||
|
||||
console.log("pick after list:");
|
||||
console.log(this.data.schoolxpList);
|
||||
console.log("pick after list backup");
|
||||
console.log(this.data.schoolxpListBackup);
|
||||
this.schoolShutdown();
|
||||
},
|
||||
|
||||
|
||||
// 从身份证号码中提取性别信息
|
||||
getSexFromIdCard: function(idCard){
|
||||
var org_gender = idCard.substring(16, 17);
|
||||
// var sex = org_gender % 2 == 1 ? "男" : "女";
|
||||
var sex = org_gender % 2 == 1 ? 1 : 2;
|
||||
|
||||
return sex; // 这里假设身份证号码长度为18位并按照标准格式存放
|
||||
},
|
||||
|
||||
// 从身份证号码中提取生日信息(格式为YYYYMMDD)
|
||||
getBirthdayFromIdCard: function(idCard){
|
||||
return idCard.substring(6, 14); // 这里假设身份证号码长度为18位并按照标准格式存放
|
||||
|
||||
},
|
||||
// 将字符串类型的生日转换成Date对象
|
||||
convertToDateObject: function(birthdayString){
|
||||
const year = birthdayString.substr(0, 4);
|
||||
const month = birthdayString.substr(4, 2);
|
||||
const day = birthdayString.substr(6, 2);
|
||||
|
||||
return new Date(`${year}-${month}-${day}`);
|
||||
|
||||
},
|
||||
|
||||
// 计算年龄函数
|
||||
calculateAge: function(idCard){
|
||||
// 获取当前日期
|
||||
const currentDate = new Date();
|
||||
|
||||
const birthdate = this.convertToDateObject(this.getBirthdayFromIdCard(idCard));
|
||||
let age;
|
||||
|
||||
if (currentDate >= birthdate && !isNaN(currentDate)) {
|
||||
age = Math.floor((currentDate - birthdate) / (365 * 24 * 60 * 60 * 1000));
|
||||
} else {
|
||||
console.error('无效的身份证号码或者未知错误');
|
||||
}
|
||||
|
||||
return age || '';
|
||||
|
||||
},
|
||||
|
||||
// 调用示例
|
||||
// const idCardNumber = 'xxxxxxxxx'; // 输入真实的身份证号码
|
||||
// console.log(calculateAge(idCardNumber));
|
||||
|
||||
|
||||
})
|
||||
6
pages/studentMsgDel/studentMsgDel.json
Normal file
6
pages/studentMsgDel/studentMsgDel.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-switch": "@vant/weapp/switch/index"
|
||||
}
|
||||
}
|
||||
203
pages/studentMsgDel/studentMsgDel.wxml
Normal file
203
pages/studentMsgDel/studentMsgDel.wxml
Normal file
@@ -0,0 +1,203 @@
|
||||
<!--pages/userMsgDel/userMsgDel.wxml-->
|
||||
<view class="main">
|
||||
<view class="content">
|
||||
<view class="title">请认真填写体检人信息</view>
|
||||
|
||||
<!-- 选择学校 -->
|
||||
<view>
|
||||
<view class="item">
|
||||
<view class="left">学校</view>
|
||||
<view class="inputf">
|
||||
<van-field
|
||||
input-class="my-input-class"
|
||||
model:value="{{ schoolname }}"
|
||||
right-icon="arrow-down"
|
||||
readonly="true"
|
||||
placeholder="请选择学校名称"
|
||||
bind:click-input="schoolOn"
|
||||
bind:click-icon="schoolOn"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-popup
|
||||
show="{{ schoolSwitch }}"
|
||||
position="bottom"
|
||||
custom-style="height: 50%"
|
||||
bind:close="schoolShutdown"
|
||||
>
|
||||
<view class="popsearch">
|
||||
<van-search
|
||||
value="{{ schoolIndexes }}"
|
||||
placeholder="请输入学校名称"
|
||||
use-action-slot
|
||||
bind:change="setschoolIndexes"
|
||||
bind:search="schoolGo"
|
||||
>
|
||||
<view slot="action" bind:tap="schoolGo" style="color:#1296db;margin-right: 10rpx;margin-left: 10rpx;"> 搜索</view>
|
||||
</van-search>
|
||||
</view>
|
||||
<view class = "pickempty" wx:if = "{{ schoolxpList.length == 0 }}">无数据</view>
|
||||
<view wx:if = "{{ schoolxpList != 0 }}">
|
||||
<van-picker
|
||||
show-toolbar
|
||||
title="请选择"
|
||||
columns="{{ schoolxpList }}"
|
||||
value-key="name"
|
||||
bind:cancel="schoolShutdown"
|
||||
bind:confirm="schoolIdentification"
|
||||
/>
|
||||
</view>
|
||||
</van-popup>
|
||||
<!-- 选择班级 -->
|
||||
<view>
|
||||
<view class="item">
|
||||
<view class="left">班级</view>
|
||||
<view class="inputf">
|
||||
<van-field
|
||||
model:value="{{ classname }}"
|
||||
right-icon="arrow-down"
|
||||
readonly="true"
|
||||
placeholder="请选择班级名称"
|
||||
input-class="my-input-class"
|
||||
bind:click-input="classOn"
|
||||
bind:click-icon="classOn"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-popup
|
||||
show="{{ classSwitch }}"
|
||||
position="bottom"
|
||||
custom-style="height: 50%"
|
||||
bind:close="classShutdown"
|
||||
>
|
||||
<view class="popsearch">
|
||||
<van-search
|
||||
value="{{ classIndexes }}"
|
||||
placeholder="请输入班级名称"
|
||||
use-action-slot
|
||||
bind:change="setclassIndexes"
|
||||
bind:search="classGo"
|
||||
>
|
||||
<view slot="action" bind:tap="classGo" style="color:#1296db;margin-right: 10rpx;margin-left: 10rpx;"> 搜索</view>
|
||||
</van-search>
|
||||
</view>
|
||||
<view class = "pickempty" wx:if = "{{ classxpList.length == 0 }}">无数据</view>
|
||||
<view wx:if = "{{ classxpList != 0 }}">
|
||||
<van-picker
|
||||
show-toolbar
|
||||
title="请选择"
|
||||
columns="{{ classxpList }}"
|
||||
value-key="name"
|
||||
bind:cancel="classShutdown"
|
||||
bind:confirm="classIdentification"
|
||||
/>
|
||||
</view>
|
||||
</van-popup>
|
||||
|
||||
|
||||
<view class="form">
|
||||
<view class="item" >
|
||||
<view class="left">姓名</view>
|
||||
<view class="input">
|
||||
<input class="sr" bindinput='trueName' bindchange='change_trueName' disabled="{{disabled}}" value="{{ trueName }}"
|
||||
placeholder-class="placeholder" placeholder="请输入真实姓名"></input>
|
||||
<!-- <view class="add">添加.</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="item">
|
||||
<view class="left">性别</view>
|
||||
<view class="input">
|
||||
<input class="sr" bindtap="showPopSex" value="{{ sexdisp }}" placeholder-class="placeholder" placeholder="请选择性别" ></input>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="item">
|
||||
<view class="left">年龄</view>
|
||||
<view class="inputf">
|
||||
<van-field
|
||||
model:value="{{ age }}"
|
||||
placeholder="请输入真实年龄"
|
||||
maxlength = "3"
|
||||
type = "number"
|
||||
/>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="item">
|
||||
<view class="left">身份证号</view>
|
||||
<view class="inputf">
|
||||
<van-field
|
||||
input-class="my-input-class"
|
||||
model:value="{{ idCard }}"
|
||||
placeholder="请输入身份证号码"
|
||||
readonly="{{ disabled }}"
|
||||
type = "idcard"
|
||||
/>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="left1">设为默认体检人 </view>
|
||||
<view class="switch">
|
||||
<van-switch class="sw" checked="{{ checked }}" bind:change="onChange" size="25px" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="msgDes">添加体检人请使用儿童的身份证号。</view>
|
||||
<view class="btn" bindtap="save">保存</view>
|
||||
<view class="btn2" wx:if="{{state == 1}}" bindtap="del">删除体检人</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <van-popup
|
||||
show="{{ showsex }}"
|
||||
round
|
||||
closeable
|
||||
position="bottom"
|
||||
bind:close="onCloseSex">
|
||||
<view class="popWrap">
|
||||
<view class="title1">选择性别</view>
|
||||
<view class="msgItem" wx:for="{{relateSex}}" wx:key="item" data-item="{{item}}" bindtap="confirmSex">{{item.name}}</view>
|
||||
</view>
|
||||
</van-popup> -->
|
||||
|
||||
<!-- <van-popup
|
||||
show="{{ show }}"
|
||||
round
|
||||
closeable
|
||||
position="bottom"
|
||||
bind:close="onClose">
|
||||
<view class="popWrap">
|
||||
<view class="title1">选择与本人关系</view>
|
||||
<view class="msgItem" wx:for="{{relate}}" wx:key="item" data-item="{{item}}" bindtap="confirm">{{item.name}}</view>
|
||||
</view>
|
||||
</van-popup> -->
|
||||
<!-- <van-popup
|
||||
show="{{ show2 }}"
|
||||
round
|
||||
closeable
|
||||
position="bottom"
|
||||
bind:close="onClose2">
|
||||
<view class="popWrap">
|
||||
<view class="title1">选择卡类型</view>
|
||||
<view class="msgItem" wx:for="{{cardType}}" wx:key="item" data-item="{{item}}" bindtap="confirm2">{{item.name}}</view>
|
||||
</view>
|
||||
</van-popup> -->
|
||||
<!-- <van-popup
|
||||
show="{{ show3 }}"
|
||||
round
|
||||
closeable
|
||||
position="bottom"
|
||||
bind:close="onClose3">
|
||||
<view class="popWrap">
|
||||
<view class="title1">选择绑定卡号</view>
|
||||
<view class="msgItem1" wx:for="{{sfzList}}" wx:key="item" data-item="{{item}}" bindtap="confirm3">
|
||||
<view class="kUp">
|
||||
<view class="k1">{{item.hzxm}}</view>
|
||||
<view class="k2">(¥{{item.zhye}})</view>
|
||||
</view>
|
||||
<view class="KDown" wx:if="{{item.cardtype == 3}}">{{item.cardno}}(电子健康卡)</view>
|
||||
<view class="KDown" wx:else>{{item.cardno}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</van-popup> -->
|
||||
</view>
|
||||
225
pages/studentMsgDel/studentMsgDel.wxss
Normal file
225
pages/studentMsgDel/studentMsgDel.wxss
Normal file
@@ -0,0 +1,225 @@
|
||||
/* pages/userMsgDel/userMsgDel.wxss */
|
||||
.my-input-class {
|
||||
border-radius: 8px; /* 增加圆角边框 */
|
||||
/* border: 1px solid rgb(248, 21, 21); */
|
||||
|
||||
font-size: 35rpx;
|
||||
}
|
||||
.inputf{
|
||||
flex: 1;
|
||||
font-size: 35rpx;
|
||||
color: #333;
|
||||
line-height: 120rpx;
|
||||
/* border: 1rpx solid #0af1a4; */
|
||||
}
|
||||
|
||||
.main{
|
||||
margin: 30rpx 0;
|
||||
width: 750rpx;
|
||||
}
|
||||
.content{
|
||||
height: 100%;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.title{
|
||||
height: 120rpx;
|
||||
width: 100%;
|
||||
font-size: 33rpx;
|
||||
color: #666;
|
||||
line-height: 120rpx;
|
||||
border-bottom: 1rpx solid #f8f8f8;
|
||||
}
|
||||
.item{
|
||||
height: 120rpx;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: 1rpx solid #f8f8f8;
|
||||
}
|
||||
.left{
|
||||
height: 100%;
|
||||
width: 140rpx;
|
||||
font-size: 35rpx;
|
||||
color: #333;
|
||||
line-height: 120rpx;
|
||||
/* border: 1rpx solid #6306f8; */
|
||||
}
|
||||
.input{
|
||||
flex: 1;
|
||||
font-size: 35rpx;
|
||||
color: #333;
|
||||
line-height: 120rpx;
|
||||
/* border: 1rpx solid #f10c0c; */
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
.inputs{
|
||||
display: flex !important;
|
||||
|
||||
}
|
||||
.sr1{
|
||||
flex:1;
|
||||
padding-left:43px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.add{
|
||||
width: 40px;
|
||||
height: 25px;
|
||||
text-align: center;
|
||||
line-height: 25px;
|
||||
/* border:1px solid #eee; */
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
margin-left: 3px;
|
||||
background-color: #006eff;
|
||||
color:#fff;
|
||||
}
|
||||
.sp{
|
||||
display: flex;
|
||||
font-size: 35rpx;
|
||||
color: #333;
|
||||
line-height: 120rpx;
|
||||
}
|
||||
.input2{
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
font-size: 30rpx;
|
||||
color: #666;
|
||||
line-height: 120rpx;
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
.input3{
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
font-size: 35rpx;
|
||||
color: #333;
|
||||
line-height: 120rpx;
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
.sr{
|
||||
border: 0;
|
||||
|
||||
/* border: 1rpx solid #f50808; */
|
||||
|
||||
}
|
||||
.placeholder{
|
||||
font-size: 30rpx;
|
||||
/* border: 1rpx solid #f50808; */
|
||||
|
||||
}
|
||||
.popWrap{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding: 10rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.popWrap :last-child{
|
||||
border: none;
|
||||
}
|
||||
.title1{
|
||||
height: 80rpx;
|
||||
width: 100%;
|
||||
font-size: 33rpx;
|
||||
color: #666;
|
||||
line-height: 80rpx;
|
||||
text-align: center
|
||||
}
|
||||
.msgItem1{
|
||||
height: 160rpx;
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
border-bottom: 1rpx solid #f8f8f8;
|
||||
}
|
||||
.kUp{
|
||||
height: 80rpx;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
.k1{
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: 35rpx;
|
||||
color: #333;
|
||||
}
|
||||
.k2{
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: 30rpx;
|
||||
color: #666;
|
||||
/* margin-left: 10rpx; */
|
||||
}
|
||||
.KDown{
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: 35rpx;
|
||||
color: #666;
|
||||
}
|
||||
.msgItem{
|
||||
height: 80rpx;
|
||||
width: 100%;
|
||||
font-size: 35rpx;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
border-bottom: 1rpx solid #f8f8f8;
|
||||
}
|
||||
.left1{
|
||||
height: 100%;
|
||||
width: 300rpx;
|
||||
font-size: 35rpx;
|
||||
color: #333;
|
||||
line-height: 120rpx;
|
||||
}
|
||||
.left1{
|
||||
height: 100%;
|
||||
width: 400rpx;
|
||||
}
|
||||
.switch{
|
||||
height: 100%;
|
||||
width: 100rpx;
|
||||
display:flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.msgDes{
|
||||
height: 180rpx;
|
||||
width: 100%;
|
||||
padding: 20rpx 15rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
margin-top: 10rpx;
|
||||
background: rgba(247,247,248);
|
||||
font-size: 30rpx;
|
||||
color: #666;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
.btn{
|
||||
height: 100rpx;
|
||||
margin-top: 50rpx;
|
||||
width: 100%;
|
||||
background: rgba(0,110,255);
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
line-height: 100rpx;
|
||||
border-radius: 10rpx;
|
||||
font-size: 35rpx;
|
||||
letter-spacing: 5rpx;
|
||||
}
|
||||
.btn2{
|
||||
height: 100rpx;
|
||||
margin-top: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
width: 100%;
|
||||
background: rgba(228,240,255);
|
||||
color: rgba(3,112,255);
|
||||
text-align: center;
|
||||
line-height: 100rpx;
|
||||
border-radius: 10rpx;
|
||||
font-size: 35rpx;
|
||||
letter-spacing: 5rpx;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user