【update】 工作组、起草组联系人编辑功能

This commit is contained in:
danshihao
2024-01-15 09:08:36 +08:00
parent b9e12e951c
commit 500e51096b
7 changed files with 471 additions and 23 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

+12 -3
View File
@@ -65,8 +65,8 @@ const UserApi = {
noticeList: (params) => http.get(`${URL_CONFIG}sysNotice/page`, params),
// 工作组分页
workList: (params) => http.get(`${URL_CONFIG}project/payWorkingGroupSubitem/queryCompanyPageList`, params),
// 起草组分页 todo 需要修改接口
draftList: (params) => http.get(`${URL_CONFIG}project/payWorkingGroupSubitem/queryCompanyPageList`, params),
// 起草组分页
draftList: (params) => http.get(`${URL_CONFIG}drafting/payDraftingGroupSubitem/queryCompanyPageList`, params),
// 分标委列表
committeeList: (params) => http.get(`${URL_CONFIG}payCaseCommitteeSubitem/payCaseCommitteeSubitem/findTwo`, params),
// 分标委详情
@@ -86,7 +86,16 @@ const UserApi = {
// 企业端的会议文件的下载
downFileDownWeb: (fileId,meetingId, params) => http.get(`${URL_CONFIG}meeting/payMeeting/userDownloadByApplet/${fileId}/${meetingId}`,params),
// 企业人员查询参与项目的邮寄信息
getVoiceMailList: (fileId,meetingId, params) => http.get(`${URL_CONFIG}mail/payMailBill/contactsSearch`,params)
getVoiceMailList: (fileId,meetingId, params) => http.get(`${URL_CONFIG}mail/payMailBill/contactsSearch`,params),
// 工作组联系人回显
getWorkContactsInfo: (params) => http.get(`${URL_CONFIG}project/payWorkingGroupSubitem/getItemById`, params),
// 工作组联系人提交
editWorkContactsInfo: (params) => http.post(`${URL_CONFIG}/project/payWorkingGroupSubitem/editCompany`, params),
// 起草组联系人回显
getDraftContactsInfo: (params) => http.get(`${URL_CONFIG}drafting/payDraftingGroupSubitem/getItemById`, params),
// 起草组联系人提交
editDraftContactsInfo: (params) => http.post(`${URL_CONFIG}drafting/payDraftingGroupSubitem/editCompany`, params),
}
export default UserApi
+259 -9
View File
@@ -5,12 +5,163 @@ Page({
* 页面的初始数据
*/
data: {
type: '', // work工作组 draft起草组
statusBarHeight: wx.getSystemInfoSync()['statusBarHeight'],
pageTitle:'联系人'
pageTitle:'联系人',
// 是否需要权限
nolimitBool: true,
// 选择的用户
selectedPerson: {},
// 选择用户下标
selectedPersonIndex: null,
// 当前选择的企业
selectedCompany: {},
// 企业联系人
personList: [{}, {}, {}],
// 选择的邮寄联系人
selectedPostPerson: {},
// 当前页的数据
model: {},
},
// 编辑联系人信息
editContactsInfo(e) {
// 选择联系人
selectPerson(e) {
const that = this
// 设置操作的下标,onLoad事件将数据放入数组
console.log('操作企业联系人下标', e.currentTarget.dataset.index);
this.setData({
selectedPersonIndex: e.currentTarget.dataset.index
})
if (!!this.data.selectedCompany.id) {
wx.navigateTo({
url: `../personList/personList?companyId=${this.data.selectedCompany.id}&selectType=${e.currentTarget.dataset.selecttype}&nolimit=${that.data.nolimitBool}`,
})
} else {
wx.showToast({
title: '请先选择参会单位',
icon: "none",
duration: 800,
});
}
},
// 添加企业联系人
handleAddContacts () {
if (this.data.personList.length >= 10) {
wx.showToast({
title: '最多添加十个企业联系人',
icon: "none",
duration: 800,
});
return
}
this.data.personList.push({})
this.setData({
personList: this.data.personList
})
},
// 删除企业联系人
handleDelContacts (e) {
const index = e.currentTarget.dataset.index
if (this.data.personList.length === 1) {
wx.showToast({
title: '最少需要一个企业联系人',
icon: "none",
duration: 800,
});
} else {
this.setData({
personList: this.data.personList.filter((_, i) => index !== i)
})
}
},
// 企业联系人备注
inputContactsRemarks (e) {
const index = e.currentTarget.dataset.index
this.data.personList[index].remarks = e.detail.value || ''
this.setData({
personList: this.data.personList
})
},
// 提交
formSubmit(e) {
// 企业联系人不能重复
const personIds = this.data.personList.map(item => item.contactsId)
if (Array.from(new Set(personIds)).length !== personIds.length) {
wx.showToast({
title: '请选择不同的联系人',
icon: 'none',
duration: 2000
})
return
}
const params = Object.assign({}, this.data.model)
// 总备注
params.remarks = e.detail.value.remarks || ''
console.log(e, params);
wx.showLoading({
title: '加载中',
mask: true
})
switch(this.data.type) {
// 工作组
case 'work':
// 联络人列表
params.payWorkingGroupSubItemContactsList = this.data.personList
UserApi.editWorkContactsInfo(params).then(res => {
if (res.success) {
wx.showToast({
title: res.message,
icon: 'loading',
duration: 1500,
success: () => {
this.goBack()
}
})
} else {
wx.showToast({
title: res.message,
icon: 'none',
duration: 2000
})
}
}).catch(e => {
wx.showToast({
title: '操作失败',
icon: 'error',
duration: 2000
})
})
break
// 起草组
case 'draft':
// 联络人列表
params.payDraftingGroupSubItemContactsList = this.data.personList
UserApi.editDraftContactsInfo(params).then(res => {
if (res.success) {
wx.showToast({
title: res.message,
icon: 'loading',
duration: 1500,
success: () => {
this.goBack()
}
})
} else {
wx.showToast({
title: res.message,
icon: 'none',
duration: 2000
})
}
}).catch(e => {
wx.showToast({
title: '操作失败',
icon: 'error',
duration: 2000
})
})
break
}
UserApi.editWorkContactsInfo
},
goBack(){
wx.navigateBack()
@@ -18,17 +169,116 @@ Page({
loadData(){
const that = this
// wx.showToast({
// title: '加载中...',
// icon: 'loading'
// })
wx.showToast({
title: '加载中...',
icon: 'loading'
})
// 根据不同入口获取不同信息
switch(that.data.type) {
// 工作组获取回显信息
case 'work':
UserApi.getWorkContactsInfo({
id: that.data._options.id,
workingGroupId: that.data._options.workingGroupId
}).then(res => {
if (res.success) {
that.setData({
model: res.result || {},
selectedCompany: {
id: res.result.chargeCompanyId,
companyName: res.result.chargeCompanyTemporaryName
},
personList: res.result.payWorkingGroupSubItemContactsList || [{}, {}, {}]
})
} else {
wx.showToast({
title: res.message,
icon: 'none',
duration: 2000
})
}
}).catch(err=>{
console.log(err);
wx.showToast({
title: '加载失败',
icon: 'none',
duration: 2000
})
})
break
// 起草组获取回显信息
case 'draft':
UserApi.getDraftContactsInfo({
id: that.data._options.id,
draftingGroupId: that.data._options.draftingGroupId
}).then(res => {
if (res.success) {
that.setData({
model: res.result || {},
selectedCompany: {
id: res.result.chargeCompanyId,
companyName: res.result.chargeCompanyTemporaryName
},
personList: res.result.payDraftingGroupSubItemContactsList || [{}, {}, {}]
})
} else {
wx.showToast({
title: res.message,
icon: 'none',
duration: 2000
})
}
}).catch(err=>{
console.log(err);
wx.showToast({
title: '加载失败',
icon: 'none',
duration: 2000
})
})
break
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.data.type = options.type
console.log(options);
this.setData({
type: options.type
})
// 保存参数
this.data._options = Object.assign({}, options)
this.loadData()
},
/**
* 声明周期函数--监听页面显示
*/
onShow: function () {
console.log('选择的用户', this.data.selectedPersonIndex, this.data.selectedPerson);
if (this.data.selectedPersonIndex !== null && this.data.selectedPersonIndex !== undefined) {
const { id, name } = this.data.selectedPerson || {}
this.data.personList[this.data.selectedPersonIndex] = {
contactsId: id,
contactsTemporaryName: name,
remarks: ''
}
// 如果是选邮件联系人
if (this.data.selectedPostPerson.id) {
this.setData({
model: Object.assign(this.data.model, {
mailContactsId: this.data.selectedPostPerson.id,
mailContactsTemporaryName: this.data.selectedPostPerson.name
})
})
}
this.setData({
selectedPostPerson: {},
selectedPerson: {},
selectedPersonIndex: null,
personList: this.data.personList
})
}
}
})
+54 -5
View File
@@ -6,11 +6,60 @@
<view class="empty_custom" style="padding-top:{{statusBarHeight}}px"></view><!-- 空view用来填充自定义头部的padding-top -->
<!-- 自定义头部end -->
<view class="color-f5 wrap">
<view class="form-wrap">
<!-- 企业名称直接回显不可修改 -->
<view class="form-item">
<form bindsubmit="formSubmit">
<view class="form-wrap">
<!-- 企业名称直接回显不可修改 -->
<view class="form-item mb20">
<text class="item-label flex-1 validate">企业名称:</text>
<input placeholder-class="text-right" bindtap="selectCompany" disabled="{{true}}" name="selectedCompany.companyName" value="{{selectedCompany.companyName}}" placeholder="请选择参会单位" />
<input placeholder-class="text-right" disabled="{{true}}" name="companyName" value="{{selectedCompany.companyName}}" placeholder="请选择参会单位" />
</view>
</view>
<!-- 企业联系人 -->
<view class="form-contacts mb20" wx:for="{{personList}}" wx:key="index">
<view class="form-contacts-head">
<view class="form-contacts-head-title {{index === 0 ? 'validate' : ''}}">企业联系人{{index + 1}}</view>
<view class="form-contacts-head-icons">
<!-- 删除联系人 -->
<image src="../../assets/images/delete.png" bind:tap="handleDelContacts" data-index="{{index}}"/>
</view>
</view>
<view class="form-contacts-name">
<view class="form-item">
<text class="item-label flex-1">姓名:</text>
<input placeholder-class="text-right" data-nolimit="{{nolimitBool}}" disabled="{{true}}" bindtap="selectPerson" data-index="{{index}}" data-selectType='1' value="{{item.contactsTemporaryName}}" placeholder="请选择企业联系人" />
</view>
</view>
<view class="form-contacts-remarks">
<view class="form-item">
<text class="item-label flex-1">备注:</text>
<input name="ContactsRemarks" placeholder-class="text-right" maxlength="50" value="{{item.remarks}}"
bindinput="inputContactsRemarks" data-index="{{index}}" placeholder="请输入备注" />
</view>
</view>
<!-- 只有最后一个显示增加且联系人按钮 -->
<view class="contacts-add" wx:if="{{index === (personList.length - 1)}}">
<view class="contacts-add-btn" bind:tap="handleAddContacts">
<image src="../../assets/images/plus.png"/><text class="ml8">添加企业联系人</text>
</view>
</view>
</view>
<!-- 邮寄联系人(工作组显示,起草组没有) -->
<view class="form-item" wx:if="{{type === 'work'}}">
<text class="item-label flex-1 validate">邮寄联系人:</text>
<input placeholder-class="text-right" data-nolimit="{{nolimitBool}}" disabled="{{true}}" bindtap="selectPerson" data-selectType='2' value="{{model.mailContactsTemporaryName}}" placeholder="请选择邮寄联系人" />
</view>
<!-- 备注 -->
<view class="form-item textarea">
<text class="item-label validate">备注</text>
<textarea placeholder="请输入备注" name="remarks" value="{{model.remarks}}" maxlength="200" />
</view>
<view class="form-item">
<view class="btn-box">
<button class="submit" formType="submit">确定</button>
</view>
</view>
</view>
</form>
</view>
+120
View File
@@ -25,3 +25,123 @@ page {
margin-left: 9px;
}
/* 头部筛选end */
/* 表单 start */
.form-item {
box-sizing: border-box;
display: flex;
padding: 32rpx;
font-size: 28rpx;
justify-content: space-between;
width: 100%;
height: 112rpx;
background-color: #fff;
}
.form-item .item-label {
position: relative;
}
/* 设置必填标记位置 */
.form-item .item-label.validate {
padding-left: 20rpx;
}
.form-item .item-label.validate::before {
left: 0;
}
/* 联系人部分 */
.form-contacts-head {
background-color: #fff;
box-sizing: border-box;
height: 112rpx;
padding: 32rpx;
display: flex;
width: 100%;
justify-content: space-between;
}
.form-contacts-head-title {
position: relative;
padding-left: 18rpx;
}
/* validate占用了before伪元素,这里使用after做左侧的 */
.form-contacts-head-title::after {
position: absolute;
top: 6rpx;
left: 0;
content: '';
display: block;
width: 6rpx;
height: 28rpx;
background: #069F99;
border-radius: 10rpx;
}
.form-contacts-head-title.validate {
padding-left: 38rpx;
}
.form-contacts-head-title.validate::before {
left: 18rpx;
}
.form-contacts-head-icons image {
width: 48rpx;
height: 48rpx;
}
.form-item input {
text-align: right;
}
.form-item.textarea {
display: block;
height: 264rpx;
}
.form-item.textarea textarea {
box-sizing: border-box;
margin-top: 24rpx;
padding: 20rpx;
width: 100%;
height: 134rpx;
border-radius: 8rpx;
border: 2rpx solid #C9CDD4;
}
/* 表单 end */
/* 添加联系人按钮 */
.contacts-add {
display: flex;
justify-content: center;
align-items: center;
background-color: #fff;
padding: 32rpx;
}
.contacts-add-btn {
display: flex;
justify-content: center;
align-items: center;
height: 46rpx;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #069F99;
border: 1px solid #069F99;
width: 100%;
height: 76rpx;
border-radius: 20rpx;
}
.contacts-add image {
line-height: 32rpx;
width: 32rpx;
height: 32rpx;
}
/* 提交按钮 */
.btn-box {
width: 100%;
padding: 32rpx;
}
.btn-box .submit {
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
width: 100%;
height: 76rpx;
border-radius: 20rpx;
background-color: #069F99;
color: white;
}
.ml8 {
margin-left: 8rpx;
}
+26 -6
View File
@@ -25,8 +25,17 @@ Page({
// 编辑联系人信息
editContactsInfo(e) {
// 跳转到联系人页面
let params = ''
switch (this.data.type) {
case 'work':
params = `workingGroupId=${e.currentTarget.dataset.project.workingGroupId}`
break
case 'draft':
params = `draftingGroupId=${e.currentTarget.dataset.project.draftingGroupId}`
break
}
wx.navigateTo({
url: `../contacts/contacts?id=${e.currentTarget.dataset.project.id}&type=${this.data.type}&workingGroupId=${e.currentTarget.dataset.project.workingGroupId}`,
url: `../contacts/contacts?id=${e.currentTarget.dataset.project.id}&type=${this.data.type}&` + params,
})
},
@@ -212,16 +221,16 @@ Page({
this.data.type = options.type
let pageTitle = ''
switch(options.type){
case 'ziliao':
case 'ziliao':
pageTitle = '资料网员'
break
case 'work':
case 'work':
pageTitle = '工作组'
break
case 'draft':
case 'draft':
pageTitle = '起草组'
break
default :
default :
pageTitle = '项目'
break
}
@@ -232,6 +241,18 @@ Page({
this.loadData()
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// 联系人操作完返回重新获取数据
this.setData({
searchParams: Object.assign({}, this.data.searchParams, {
pageNo: 1
})
})
this.loadData()
},
/**
* 页面上拉触底事件的处理函数
*/
@@ -240,4 +261,3 @@ Page({
this.loadData()
},
})