From 500e51096ba35c0c47407128fb4d9766747e3a89 Mon Sep 17 00:00:00 2001 From: danshihao Date: Mon, 15 Jan 2024 09:08:36 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90update=E3=80=91=20=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E7=BB=84=E3=80=81=E8=B5=B7=E8=8D=89=E7=BB=84=E8=81=94=E7=B3=BB?= =?UTF-8?q?=E4=BA=BA=E7=BC=96=E8=BE=91=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/images/delete.png | Bin 0 -> 403 bytes assets/images/plus.png | Bin 0 -> 274 bytes assets/js/http/userApi.js | 15 +- pages/contacts/contacts.js | 268 +++++++++++++++++++++++++++++++++-- pages/contacts/contacts.wxml | 59 +++++++- pages/contacts/contacts.wxss | 120 ++++++++++++++++ pages/project/project.js | 32 ++++- 7 files changed, 471 insertions(+), 23 deletions(-) create mode 100644 assets/images/delete.png create mode 100644 assets/images/plus.png diff --git a/assets/images/delete.png b/assets/images/delete.png new file mode 100644 index 0000000000000000000000000000000000000000..044372a4b819ac66399455e1b00e0f1f75008269 GIT binary patch literal 403 zcmV;E0c`$>P)Px$O-V#SRA@u(SV3;WFc7q*9QX!OpU``s<48I5!o6^(5|XBbv24$+ zqXH?c_;-hY>7e-Ee3j3{XoDzD0GG@dYAnPsicC>pS z_T4#m2(2jmzl|~G^IA@LjMjDiQWV9PQfeiYP)Px#%t=H+R9Hu2WEcd1aS*tHVHh}K)hcGTFYnfZLX(k+@$k=t^j>m8ma>qTIg^!* zjo}y6;$^=Q)1yZn!N9;U8WN*vf`MT)cfbmRVI2~zbLJQ_GXIq)s^nv2WM=sPe+{_U z{?BmaKO+Ot#rChyKld@@<$VI{MYoJ~{)}0S42-EnIf4>JfBtCwO3l7Lh#j$Tx*_8~ zrh$zPl0tY`=Z?{kASnb!M2SgKh>Yfr(KLacU_hOpuh7m9<3M$ONJ_=H6;sv&8%~Y@ Y0IuwuA$B3N4*&oF07*qoM6N<$f;;hZP5=M^ literal 0 HcmV?d00001 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 @@ - - - +
+ + + 企业名称: - + - + + + + 企业联系人{{index + 1}} + + + + + + + + 姓名: + + + + + + 备注: + + + + + + + 添加企业联系人 + + + + + + + 邮寄联系人: + + + + + + 备注 +