diff --git a/assets/images/delete.png b/assets/images/delete.png
new file mode 100644
index 0000000..044372a
Binary files /dev/null and b/assets/images/delete.png differ
diff --git a/assets/images/plus.png b/assets/images/plus.png
new file mode 100644
index 0000000..163292a
Binary files /dev/null and b/assets/images/plus.png differ
diff --git a/assets/js/http/userApi.js b/assets/js/http/userApi.js
index 8161583..b1f4271 100644
--- a/assets/js/http/userApi.js
+++ b/assets/js/http/userApi.js
@@ -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
diff --git a/pages/contacts/contacts.js b/pages/contacts/contacts.js
index 0e20765..0dd471d 100644
--- a/pages/contacts/contacts.js
+++ b/pages/contacts/contacts.js
@@ -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
+ })
+ }
}
})
\ No newline at end of file
diff --git a/pages/contacts/contacts.wxml b/pages/contacts/contacts.wxml
index 5d96402..0aa9f60 100644
--- a/pages/contacts/contacts.wxml
+++ b/pages/contacts/contacts.wxml
@@ -6,11 +6,60 @@
-
-
-
+
+
\ No newline at end of file
diff --git a/pages/contacts/contacts.wxss b/pages/contacts/contacts.wxss
index 308a7ce..ab40fc9 100644
--- a/pages/contacts/contacts.wxss
+++ b/pages/contacts/contacts.wxss
@@ -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;
+}
\ No newline at end of file
diff --git a/pages/project/project.js b/pages/project/project.js
index 955ea6c..bb00cd0 100644
--- a/pages/project/project.js
+++ b/pages/project/project.js
@@ -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()
},
})
-
\ No newline at end of file