mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 17:49:36 +08:00
1
This commit is contained in:
parent
2ab5f68656
commit
b8d989a2bc
@ -1,4 +1,7 @@
|
||||
let app = getApp();
|
||||
|
||||
import Notify from '@vant/weapp/notify/notify';
|
||||
|
||||
import {
|
||||
companyRq
|
||||
} from "../../../../api/meeting/visitorIinvitation.js"
|
||||
@ -9,7 +12,24 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
IMG_NAME: app.IMG_NAME,
|
||||
detail: {
|
||||
customerId: null, //企业id
|
||||
customerName: null, //企业名称
|
||||
userId: null, // 被访人id
|
||||
username: null, //被访人姓名
|
||||
mobile: null, //被访人手机号
|
||||
intervieweeId: null, // 访客id
|
||||
name: null, // 访客姓名
|
||||
phone: null, // 访客手机号
|
||||
joinTime: null, // 加入时间
|
||||
visitTime: null, // 到访时间
|
||||
leaveTime: null, // 离开时间
|
||||
visitContent: null, // 来访事由
|
||||
cardType: null, // 证件类型
|
||||
cardNo: null, // 证件号
|
||||
photo: null, // 头像
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -32,9 +52,24 @@ Page({
|
||||
// 跳转-索引栏(单位、人员)
|
||||
jumpIndexBar(e) {
|
||||
console.log('jumpIndexBar', e);
|
||||
let _this = this;
|
||||
let title = e.currentTarget.dataset.title
|
||||
// 校验是否选择“被访单位” 后 ,再选择被访人信息
|
||||
if (title == '人员' && !_this.data.detail.customerId) {
|
||||
// 危险通知
|
||||
Notify({
|
||||
type: 'danger',
|
||||
message: '请先选择被访单位!'
|
||||
});
|
||||
return ;
|
||||
}
|
||||
// url 参数
|
||||
let param = '?title=' + title;
|
||||
if (title == '人员') {
|
||||
param = param + '&id=' + _this.data.detail.customerId;
|
||||
}
|
||||
wx.navigateTo({
|
||||
url: '/pages/meeting/visitorIinvitation/indexBar/indexBar?title=' + title,
|
||||
url: '/pages/meeting/visitorIinvitation/indexBar/indexBar' + param,
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -9,8 +9,7 @@
|
||||
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-cell": "@vant/weapp/cell/index",
|
||||
"van-index-bar": "@vant/weapp/index-bar/index",
|
||||
"van-index-anchor": "@vant/weapp/index-anchor/index"
|
||||
"van-notify": "@vant/weapp/notify/index"
|
||||
}
|
||||
|
||||
}
|
@ -5,15 +5,15 @@
|
||||
<view class="contentView">
|
||||
<view class="rowView" bind:tap="jumpIndexBar" data-title="单位">
|
||||
<view class="label must">被访单位</view>
|
||||
<van-field model:value="{{ }}" input-class="input" is-link readonly placeholder="请选择" input-align="right" border="{{ false }}"/>
|
||||
<van-field model:value="{{ detail.customerName }}" input-class="input" is-link readonly placeholder="请选择" input-align="right" border="{{ false }}"/>
|
||||
</view>
|
||||
<view class="rowView" bind:tap="jumpIndexBar" data-title="人员">
|
||||
<view class="label must">被访人姓名</view>
|
||||
<van-field model:value="{{ value }}" input-class="input" is-link readonly placeholder="请选择" border="{{ false }}" input-align="right"/>
|
||||
<van-field model:value="{{ detail.username }}" input-class="input" is-link readonly placeholder="请选择" border="{{ false }}" input-align="right"/>
|
||||
</view>
|
||||
<view class="rowView">
|
||||
<view class="rowView" bind:tap="jumpIndexBar" data-title="人员">
|
||||
<view class="label must">被访人电话</view>
|
||||
<van-field model:value="{{ value }}" is-link readonly input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" bind:tap="jumpPerson"/>
|
||||
<van-field model:value="{{ detail.mobile }}" is-link readonly input-class="input" placeholder="请输入" border="{{ false }}" input-align="right"/>
|
||||
</view>
|
||||
<view class="rowView">
|
||||
<view class="label must">访客姓名</view>
|
||||
@ -60,3 +60,6 @@
|
||||
<!-- 提交 -->
|
||||
<view class="submitBtnView" bind:click="submitFormFn">提交</view>
|
||||
</view>
|
||||
|
||||
<!-- 消息通知 -->
|
||||
<van-notify id="van-notify" />
|
@ -7,6 +7,7 @@ Page({
|
||||
|
||||
data: {
|
||||
title: '',
|
||||
id: null,
|
||||
/** 索引栏*/
|
||||
indexList: [],
|
||||
/** 数据*/
|
||||
@ -34,7 +35,6 @@ Page({
|
||||
// 获取企业下的所有用户
|
||||
_this.getVisitorSelectUserByCustomer()
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// 获取所有的企业
|
||||
@ -43,16 +43,12 @@ Page({
|
||||
visitorListRq().then(res => {
|
||||
console.log('getVisitorList', res);
|
||||
let filterDataList = res.rows.map(item => {
|
||||
let otherData = JSON.stringify({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
mailAddress: item.mailAddress,
|
||||
})
|
||||
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
otherData
|
||||
otherData: JSON.stringify({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
})
|
||||
}
|
||||
})
|
||||
// 赋值并且格式化数据
|
||||
@ -62,8 +58,21 @@ Page({
|
||||
|
||||
// 获取企业下的所有用户
|
||||
getVisitorSelectUserByCustomer() {
|
||||
visitorSelectUserByCustomerRq().then(res => {
|
||||
let _this = this;
|
||||
visitorSelectUserByCustomerRq(_this.data.id).then(res => {
|
||||
console.log('getVisitorSelectUserByCustomer', res);
|
||||
let filterDataList = res.rows.map(item => {
|
||||
return {
|
||||
label: item.username + '-' + item.mobile,
|
||||
otherData: JSON.stringify({
|
||||
id: item.id,
|
||||
username: item.username,
|
||||
mobile: item.mobile,
|
||||
})
|
||||
}
|
||||
})
|
||||
// 赋值并且格式化数据
|
||||
_this.setAndFormatData(filterDataList)
|
||||
})
|
||||
},
|
||||
|
||||
@ -123,8 +132,34 @@ Page({
|
||||
// 选择
|
||||
selectClick(e) {
|
||||
console.log('selectClick', e);
|
||||
let _this = this;
|
||||
// 获取点击行数据
|
||||
let label = e.currentTarget.dataset.label
|
||||
let value = e.currentTarget.dataset.value
|
||||
let otherdata = JSON.parse(e.currentTarget.dataset.otherdata)
|
||||
//
|
||||
let pages = getCurrentPages(); //获取page
|
||||
let prevPage = pages[pages.length - 2]; //上一个页面(父页面)
|
||||
// 上个页面数据
|
||||
let detail = prevPage.data.detail;
|
||||
// 更新上个页面对应的数据
|
||||
if (_this.data.title == '单位') {
|
||||
detail.customerId = otherdata.id //企业id
|
||||
detail.customerName = otherdata.name //企业名称
|
||||
detail.userId = null //被访人id
|
||||
detail.username = null //被访人姓名
|
||||
detail.mobile = null //被访人手机号
|
||||
}
|
||||
if (_this.data.title == '人员') {
|
||||
detail.userId = otherdata.id //被访人id
|
||||
detail.username = otherdata.username //被访人姓名
|
||||
detail.mobile = otherdata.mobile //被访人手机号
|
||||
}
|
||||
// 赋值上个页面的数据
|
||||
prevPage.setData({
|
||||
detail
|
||||
})
|
||||
// 后退页面
|
||||
wx.navigateBack();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -3,6 +3,7 @@
|
||||
"usingComponents": {
|
||||
"van-cell": "@vant/weapp/cell/index",
|
||||
"van-index-bar": "@vant/weapp/index-bar/index",
|
||||
"van-index-anchor": "@vant/weapp/index-anchor/index"
|
||||
"van-index-anchor": "@vant/weapp/index-anchor/index",
|
||||
"van-divider": "@vant/weapp/divider/index"
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
<van-index-bar index-list="{{ indexList }}" highlight-color="#4e96f8">
|
||||
<view wx:for="{{dataList}}" wx:key="*this" wx:for-item="indexData">
|
||||
<van-index-anchor index="{{indexData.title}}"></van-index-anchor>
|
||||
<van-cell title="{{data.label}}" wx:for="{{indexData.list}}" wx:key="*this" wx:for-item="data" data-label="{{data.label}}" data-otherData="{{data.otherData}}" bind:tap="selectClick" clickable/>
|
||||
<van-cell title="{{data.label}}" wx:for="{{indexData.list}}" wx:key="*this" wx:for-item="data" data-label="{{data.label}}" data-otherData="{{data.otherData}}" bind:tap="selectClick" clickable />
|
||||
</view>
|
||||
</van-index-bar>
|
||||
|
||||
<van-divider wx:if="{{indexList.length == 0}}" contentPosition="center" customStyle="font-size: 28rpx; margin-top:120rpx;">暂无数据</van-divider>
|
Loading…
x
Reference in New Issue
Block a user