|
|
@@ -1,34 +1,35 @@
|
|
|
const _Http = getApp().globalData.http;
|
|
|
Page({
|
|
|
data: {
|
|
|
+ fromShowAll: true,
|
|
|
form: [{
|
|
|
label: "姓名",
|
|
|
error: false,
|
|
|
errMsg: "",
|
|
|
type: "text",
|
|
|
value: "",
|
|
|
- placeholder: "请填写",
|
|
|
+ placeholder: "联系人名称",
|
|
|
valueName: "name",
|
|
|
required: true,
|
|
|
checking: "base"
|
|
|
}, {
|
|
|
- label: "公司名称",
|
|
|
+ label: "手机号",
|
|
|
error: false,
|
|
|
errMsg: "",
|
|
|
- type: "textarea",
|
|
|
+ type: "number",
|
|
|
value: "",
|
|
|
- placeholder: "请填写",
|
|
|
- valueName: "address",
|
|
|
- required: false,
|
|
|
- checking: "base"
|
|
|
+ placeholder: "联系人手机号码",
|
|
|
+ valueName: "phonenumber",
|
|
|
+ required: true,
|
|
|
+ checking: "phone"
|
|
|
}, {
|
|
|
label: "部门",
|
|
|
error: false,
|
|
|
errMsg: "",
|
|
|
type: "text",
|
|
|
value: "",
|
|
|
- placeholder: "请填写",
|
|
|
- valueName: "name",
|
|
|
+ placeholder: "联系人所属部门",
|
|
|
+ valueName: "depname",
|
|
|
required: false,
|
|
|
checking: "base"
|
|
|
}, {
|
|
|
@@ -37,18 +38,18 @@ Page({
|
|
|
errMsg: "",
|
|
|
type: "text",
|
|
|
value: "",
|
|
|
- placeholder: "请填写",
|
|
|
- valueName: "name",
|
|
|
+ placeholder: "联系人职位",
|
|
|
+ valueName: "position",
|
|
|
required: false,
|
|
|
checking: "base"
|
|
|
}, {
|
|
|
label: "性别",
|
|
|
error: false,
|
|
|
errMsg: "",
|
|
|
- type: "text",
|
|
|
+ type: "sex",
|
|
|
value: "",
|
|
|
- placeholder: "请填写",
|
|
|
- valueName: "name",
|
|
|
+ placeholder: "联系人性别",
|
|
|
+ valueName: "sex",
|
|
|
required: false,
|
|
|
checking: "base"
|
|
|
}, {
|
|
|
@@ -57,64 +58,54 @@ Page({
|
|
|
errMsg: "",
|
|
|
type: "date",
|
|
|
value: "",
|
|
|
- placeholder: "请填写",
|
|
|
- valueName: "name",
|
|
|
- required: false,
|
|
|
- checking: "base"
|
|
|
+ placeholder: "联系人生日",
|
|
|
+ valueName: "birthday",
|
|
|
+ required: false
|
|
|
}, {
|
|
|
- label: "群组",
|
|
|
+ label: "邮箱",
|
|
|
error: false,
|
|
|
errMsg: "",
|
|
|
- type: "text",
|
|
|
+ type: "textarea",
|
|
|
value: "",
|
|
|
placeholder: "请填写",
|
|
|
- valueName: "name",
|
|
|
+ valueName: "email",
|
|
|
required: false,
|
|
|
- checking: "base"
|
|
|
+ checking: "mail"
|
|
|
}, {
|
|
|
- label: "备注",
|
|
|
+ label: "地区",
|
|
|
error: false,
|
|
|
errMsg: "",
|
|
|
- type: "textarea",
|
|
|
- value: "",
|
|
|
- placeholder: "请填写",
|
|
|
- valueName: "address",
|
|
|
- required: false,
|
|
|
- checking: "base"
|
|
|
+ type: "region",
|
|
|
+ value: [],
|
|
|
+ placeholder: "省,市,区",
|
|
|
+ valueName: "region",
|
|
|
+ required: false
|
|
|
}, {
|
|
|
- label: "负责人",
|
|
|
+ label: "详细地址",
|
|
|
error: false,
|
|
|
errMsg: "",
|
|
|
type: "textarea",
|
|
|
value: "",
|
|
|
- placeholder: "请填写",
|
|
|
+ placeholder: "例: 科创园11栋1103室",
|
|
|
valueName: "address",
|
|
|
- required: true,
|
|
|
+ required: false,
|
|
|
checking: "base"
|
|
|
}, {
|
|
|
- label: "负责人部门",
|
|
|
+ label: "备注",
|
|
|
error: false,
|
|
|
errMsg: "",
|
|
|
type: "textarea",
|
|
|
value: "",
|
|
|
placeholder: "请填写",
|
|
|
- valueName: "address",
|
|
|
+ valueName: "remarks",
|
|
|
required: false,
|
|
|
checking: "base"
|
|
|
- }, ],
|
|
|
-
|
|
|
+ }],
|
|
|
disabled: true,
|
|
|
-
|
|
|
"content": {
|
|
|
"contactsid": 0, //地址id
|
|
|
"sys_enterpriseid": 0, //绑定数据
|
|
|
- "sex": "",
|
|
|
- "depname": "",
|
|
|
- "position": "",
|
|
|
- "isleader": 0,
|
|
|
- "birthday": "",
|
|
|
- "email": "",
|
|
|
- "remarks": "",
|
|
|
+ "isleader": 0, //默认0
|
|
|
"workaddress": 0,
|
|
|
"isdefault": 0, //是否默认地址
|
|
|
"isprimary": 0 //是否为主地址
|
|
|
@@ -122,19 +113,19 @@ Page({
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
if (options.data) {
|
|
|
- let item = JSON.parse(options.data)
|
|
|
+ let item = JSON.parse(options.data),
|
|
|
+ form = this.data.form.map(v => {
|
|
|
+ if (v.valueName == 'region') {
|
|
|
+ v.value = [item.province, item.city, item.county]
|
|
|
+ } else {
|
|
|
+ v.value = Object.hasOwn(item, v.valueName) ? item[v.valueName] : v.value;
|
|
|
+ }
|
|
|
+ return v
|
|
|
+ });
|
|
|
this.setData({
|
|
|
- content: {
|
|
|
- ...this.data.content,
|
|
|
- ...item
|
|
|
- },
|
|
|
- "content.isdefault": item.isdefault,
|
|
|
- 'form[0].value': item.name,
|
|
|
- 'form[1].value': item.phonenumber,
|
|
|
- 'form[2].value': [item.province, item.city, item.county],
|
|
|
- 'form[3].value': item.address,
|
|
|
- 'content.isdefault': item.isdefault,
|
|
|
- "disabled": false
|
|
|
+ form,
|
|
|
+ "disabled": false,
|
|
|
+ "content.contactsid": item.contactsid
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
@@ -145,9 +136,9 @@ Page({
|
|
|
const content = {
|
|
|
...this.data.content,
|
|
|
...data,
|
|
|
- "province": data.region[0],
|
|
|
- "city": data.region[1],
|
|
|
- "county": data.region[2],
|
|
|
+ "province": data.region[0] || "",
|
|
|
+ "city": data.region[1] || "",
|
|
|
+ "county": data.region[2] || "",
|
|
|
};
|
|
|
delete(content.region);
|
|
|
let pages = getCurrentPages();
|
|
|
@@ -156,7 +147,7 @@ Page({
|
|
|
"id": "20221018141802",
|
|
|
content
|
|
|
}).then(res => {
|
|
|
- console.log("添加地址", res)
|
|
|
+ console.log("编辑联系人", res)
|
|
|
if (res.msg != '成功') return wx.showToast({
|
|
|
title: res.data,
|
|
|
icon: "none"
|
|
|
@@ -167,16 +158,10 @@ Page({
|
|
|
});
|
|
|
setTimeout(() => {
|
|
|
let pages = getCurrentPages();
|
|
|
- pages[pages.length - 2].partialRenewal();
|
|
|
+ pages[pages.length - 2].partialRenewal(true);
|
|
|
wx.navigateBack();
|
|
|
}, 500)
|
|
|
- })
|
|
|
- },
|
|
|
- /* 设置默认 */
|
|
|
- checkboxChange() {
|
|
|
- this.setData({
|
|
|
- "content.isdefault": this.data.content.isdefault == 1 ? 0 : 1
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
/* 表单是否填写完成 */
|
|
|
onConfirm({
|
|
|
@@ -186,5 +171,12 @@ Page({
|
|
|
disabled: detail
|
|
|
})
|
|
|
},
|
|
|
- onShareAppMessage() {}
|
|
|
+ /* 是否显示全部 */
|
|
|
+ changefromShowAll({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ fromShowAll: detail
|
|
|
+ })
|
|
|
+ },
|
|
|
})
|