This commit is contained in:
SelfRidicule 2024-03-09 15:49:42 +08:00
parent 2ab5f68656
commit b8d989a2bc
6 changed files with 99 additions and 24 deletions

View File

@ -1,4 +1,7 @@
let app = getApp(); let app = getApp();
import Notify from '@vant/weapp/notify/notify';
import { import {
companyRq companyRq
} from "../../../../api/meeting/visitorIinvitation.js" } from "../../../../api/meeting/visitorIinvitation.js"
@ -9,7 +12,24 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { 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) { jumpIndexBar(e) {
console.log('jumpIndexBar', e); console.log('jumpIndexBar', e);
let _this = this;
let title = e.currentTarget.dataset.title 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({ wx.navigateTo({
url: '/pages/meeting/visitorIinvitation/indexBar/indexBar?title=' + title, url: '/pages/meeting/visitorIinvitation/indexBar/indexBar' + param,
}) })
}, },

View File

@ -9,8 +9,7 @@
"van-datetime-picker": "@vant/weapp/datetime-picker/index", "van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-dialog": "@vant/weapp/dialog/index", "van-dialog": "@vant/weapp/dialog/index",
"van-cell": "@vant/weapp/cell/index", "van-cell": "@vant/weapp/cell/index",
"van-index-bar": "@vant/weapp/index-bar/index", "van-notify": "@vant/weapp/notify/index"
"van-index-anchor": "@vant/weapp/index-anchor/index"
} }
} }

View File

@ -5,15 +5,15 @@
<view class="contentView"> <view class="contentView">
<view class="rowView" bind:tap="jumpIndexBar" data-title="单位"> <view class="rowView" bind:tap="jumpIndexBar" data-title="单位">
<view class="label must">被访单位</view> <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>
<view class="rowView" bind:tap="jumpIndexBar" data-title="人员"> <view class="rowView" bind:tap="jumpIndexBar" data-title="人员">
<view class="label must">被访人姓名</view> <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>
<view class="rowView"> <view class="rowView" bind:tap="jumpIndexBar" data-title="人员">
<view class="label must">被访人电话</view> <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>
<view class="rowView"> <view class="rowView">
<view class="label must">访客姓名</view> <view class="label must">访客姓名</view>
@ -59,4 +59,7 @@
<!-- 提交 --> <!-- 提交 -->
<view class="submitBtnView" bind:click="submitFormFn">提交</view> <view class="submitBtnView" bind:click="submitFormFn">提交</view>
</view> </view>
<!-- 消息通知 -->
<van-notify id="van-notify" />

View File

@ -7,6 +7,7 @@ Page({
data: { data: {
title: '', title: '',
id: null,
/** 索引栏*/ /** 索引栏*/
indexList: [], indexList: [],
/** 数据*/ /** 数据*/
@ -34,7 +35,6 @@ Page({
// 获取企业下的所有用户 // 获取企业下的所有用户
_this.getVisitorSelectUserByCustomer() _this.getVisitorSelectUserByCustomer()
} }
}, },
// 获取所有的企业 // 获取所有的企业
@ -43,16 +43,12 @@ Page({
visitorListRq().then(res => { visitorListRq().then(res => {
console.log('getVisitorList', res); console.log('getVisitorList', res);
let filterDataList = res.rows.map(item => { let filterDataList = res.rows.map(item => {
let otherData = JSON.stringify({
id: item.id,
name: item.name,
mailAddress: item.mailAddress,
})
return { return {
label: item.name, label: item.name,
value: item.id, otherData: JSON.stringify({
otherData id: item.id,
name: item.name,
})
} }
}) })
// 赋值并且格式化数据 // 赋值并且格式化数据
@ -62,8 +58,21 @@ Page({
// 获取企业下的所有用户 // 获取企业下的所有用户
getVisitorSelectUserByCustomer() { getVisitorSelectUserByCustomer() {
visitorSelectUserByCustomerRq().then(res => { let _this = this;
visitorSelectUserByCustomerRq(_this.data.id).then(res => {
console.log('getVisitorSelectUserByCustomer', 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)
}) })
}, },
@ -118,13 +127,39 @@ Page({
}, },
// 选择 // 选择
selectClick(e) { selectClick(e) {
console.log('selectClick', e); console.log('selectClick', e);
let _this = this;
// 获取点击行数据
let label = e.currentTarget.dataset.label 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();
}, },
/** /**

View File

@ -3,6 +3,7 @@
"usingComponents": { "usingComponents": {
"van-cell": "@vant/weapp/cell/index", "van-cell": "@vant/weapp/cell/index",
"van-index-bar": "@vant/weapp/index-bar/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"
} }
} }

View File

@ -1,6 +1,8 @@
<van-index-bar index-list="{{ indexList }}" highlight-color="#4e96f8"> <van-index-bar index-list="{{ indexList }}" highlight-color="#4e96f8">
<view wx:for="{{dataList}}" wx:key="*this" wx:for-item="indexData"> <view wx:for="{{dataList}}" wx:key="*this" wx:for-item="indexData">
<van-index-anchor index="{{indexData.title}}"></van-index-anchor> <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> </view>
</van-index-bar> </van-index-bar>
<van-divider wx:if="{{indexList.length == 0}}" contentPosition="center" customStyle="font-size: 28rpx; margin-top:120rpx;">暂无数据</van-divider>