|
|
@@ -15,7 +15,7 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- gradeCode: app.globalData.company.gradeCode,
|
|
|
+ gradeCode: app.globalData.company.gradeCode,
|
|
|
buttonList: [{
|
|
|
name: 'merge',
|
|
|
title: mixins.$t("save"), //'保存'
|
|
|
@@ -23,60 +23,60 @@ Page({
|
|
|
cardList: ['main', 'staff', 'other'],
|
|
|
contentObj: {
|
|
|
main: [{ //供应商名称
|
|
|
- code: 'supName',
|
|
|
- type: 'textarea',
|
|
|
- title: mixins.$t("supplierName"),
|
|
|
- required: true,
|
|
|
- }, { //供应商类别
|
|
|
- code: 'supType',
|
|
|
- name: 'supTypeName',
|
|
|
- title: mixins.$t("supplierType"),
|
|
|
- type: 'drop',
|
|
|
- dropType: 'supType',
|
|
|
- // type: 'choose',
|
|
|
- // urlKey: 'chooseSupplierCategory',
|
|
|
- required: true,
|
|
|
- changeObj: {
|
|
|
- [Constants.kindCode.supplierPur]: {
|
|
|
- hide: ['serviceCategorie'],
|
|
|
- visible: ['brandId']
|
|
|
- },
|
|
|
- [Constants.kindCode.supplierOutsourcing]: {
|
|
|
- hide: ['serviceCategorie'],
|
|
|
- visible: ['brandId']
|
|
|
- },
|
|
|
- [Constants.kindCode.supplierService]: {
|
|
|
- hide: ['brandId'],
|
|
|
- visible: ['serviceCategorie']
|
|
|
- }
|
|
|
+ code: 'supName',
|
|
|
+ type: 'textarea',
|
|
|
+ title: mixins.$t("supplierName"),
|
|
|
+ required: true,
|
|
|
+ }, { //供应商类别
|
|
|
+ code: 'supType',
|
|
|
+ name: 'supTypeName',
|
|
|
+ title: mixins.$t("supplierType"),
|
|
|
+ type: 'drop',
|
|
|
+ dropType: 'supType',
|
|
|
+ // type: 'choose',
|
|
|
+ // urlKey: 'chooseSupplierCategory',
|
|
|
+ required: true,
|
|
|
+ changeObj: {
|
|
|
+ [Constants.kindCode.supplierPur]: {
|
|
|
+ hide: ['serviceCategorie'],
|
|
|
+ visible: ['brandId']
|
|
|
},
|
|
|
- }, { //供应品牌
|
|
|
- code: 'brandId',
|
|
|
- name: 'brandName',
|
|
|
- title: mixins.$t("brandId"),
|
|
|
- type: 'choose',
|
|
|
- urlKey: 'chooseBrandy',
|
|
|
- }, { //服务类别
|
|
|
- code: 'serviceCategorie',
|
|
|
- name: 'serviceCategoriesName',
|
|
|
- title: mixins.$t("ServiceCategories"),
|
|
|
- type: 'choose',
|
|
|
- urlKey: 'chooseServiceCategory',
|
|
|
- }, { //联系人
|
|
|
- code: 'contactName',
|
|
|
- type: 'textarea',
|
|
|
- title: mixins.$t("contactName"),
|
|
|
+ [Constants.kindCode.supplierOutsourcing]: {
|
|
|
+ hide: ['serviceCategorie'],
|
|
|
+ visible: ['brandId']
|
|
|
+ },
|
|
|
+ [Constants.kindCode.supplierService]: {
|
|
|
+ hide: ['brandId'],
|
|
|
+ visible: ['serviceCategorie']
|
|
|
+ }
|
|
|
},
|
|
|
- { //联系电话
|
|
|
- code: 'contactPhone',
|
|
|
- type: 'phone',
|
|
|
- title: mixins.$t("contactPhone"),
|
|
|
+ }, { //供应品牌
|
|
|
+ code: 'brandId',
|
|
|
+ name: 'brandName',
|
|
|
+ title: mixins.$t("brandId"),
|
|
|
+ type: 'choose',
|
|
|
+ urlKey: 'chooseBrandy',
|
|
|
+ }, { //服务类别
|
|
|
+ code: 'serviceCategorie',
|
|
|
+ name: 'serviceCategoriesName',
|
|
|
+ title: mixins.$t("ServiceCategories"),
|
|
|
+ type: 'choose',
|
|
|
+ urlKey: 'chooseServiceCategory',
|
|
|
+ }, { //联系人
|
|
|
+ code: 'contactName',
|
|
|
+ type: 'textarea',
|
|
|
+ title: mixins.$t("contactName"),
|
|
|
+ },
|
|
|
+ { //联系电话
|
|
|
+ code: 'contactPhone',
|
|
|
+ type: 'phone',
|
|
|
+ title: mixins.$t("contactPhone"),
|
|
|
|
|
|
- }, {
|
|
|
- code: 'returnAddress',
|
|
|
- type: 'address',
|
|
|
- title: mixins.$t("returnAddress"),
|
|
|
- }
|
|
|
+ }, {
|
|
|
+ code: 'returnAddress',
|
|
|
+ type: 'address',
|
|
|
+ title: mixins.$t("returnAddress"),
|
|
|
+ }
|
|
|
],
|
|
|
staff: [{ //采购人员
|
|
|
code: 'staffId',
|
|
|
@@ -117,10 +117,10 @@ Page({
|
|
|
let formData = JSON.parse(this.data.formData)
|
|
|
let code = e.detail.code
|
|
|
if (code == "supType") { //供应商类别
|
|
|
- return
|
|
|
+ return
|
|
|
}
|
|
|
let data = e.detail.data.data
|
|
|
-
|
|
|
+
|
|
|
if (code == "serviceCategorie") { //供应商服务类别
|
|
|
let ids = []
|
|
|
let names = []
|
|
|
@@ -151,18 +151,18 @@ Page({
|
|
|
});
|
|
|
let contentObj = this.data.contentObj
|
|
|
contentObj.main.forEach(element => {
|
|
|
- if(element.code == "brandId"){
|
|
|
- element.datalist = data.list
|
|
|
+ if (element.code == "brandId") {
|
|
|
+ element.datalist = data.list
|
|
|
}
|
|
|
});
|
|
|
this.setData({
|
|
|
- contentObj:contentObj
|
|
|
+ contentObj: contentObj
|
|
|
})
|
|
|
}
|
|
|
formData.brandId = ids.join(',')
|
|
|
formData.brandName = names.join(',')
|
|
|
formData.brandIds = ids
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
this.setData({
|
|
|
formData: JSON.stringify(formData)
|
|
|
@@ -185,12 +185,12 @@ Page({
|
|
|
let index = contentObj.staff.findIndex(t => t.code == 'startAmount')
|
|
|
contentObj.staff[index].readonly = true
|
|
|
//新建的时候 不显示编码 编辑的时候 显示编码
|
|
|
- contentObj.main = [ {
|
|
|
+ contentObj.main = [{
|
|
|
code: 'supCode',
|
|
|
type: 'textarea',
|
|
|
title: mixins.$t("supplierCode"),
|
|
|
readonly: true
|
|
|
- },{ //供应商名称
|
|
|
+ }, { //供应商名称
|
|
|
code: 'supName',
|
|
|
type: 'textarea',
|
|
|
title: mixins.$t("supplierName"),
|
|
|
@@ -245,8 +245,8 @@ Page({
|
|
|
type: 'address',
|
|
|
title: mixins.$t("returnAddress"),
|
|
|
}
|
|
|
- ],
|
|
|
- data.brandName = data.brandNames
|
|
|
+ ],
|
|
|
+ data.brandName = data.brandNames
|
|
|
this.setData({
|
|
|
contentObj: contentObj,
|
|
|
formData: JSON.stringify(data)
|
|
|
@@ -292,134 +292,136 @@ Page({
|
|
|
// 标准版:新建供应商类型默认外协供应商,且不能点开;
|
|
|
//专业版:默认采购供应商,点开是侧拉样式不是跳页(因为不能新建);
|
|
|
let contentObj = this.data.contentObj
|
|
|
+ console.log('dddd', this.data.formType);
|
|
|
let formData = this.data.formData ? JSON.parse(this.data.formData) : {}
|
|
|
- if (this.data.gradeCode == Constants.gradeCode.STD) { //标准
|
|
|
+ if (this.data.gradeCode == Constants.gradeCode.STD ||
|
|
|
+ this.data.formType == Constants.chooseType.outSupplier) { //标准
|
|
|
contentObj.main = [{ //供应商名称
|
|
|
- code: 'supName',
|
|
|
- type: 'textarea',
|
|
|
- title: mixins.$t("supplierName"),
|
|
|
- required: true,
|
|
|
- }, { //供应商类别
|
|
|
- code: 'supType',
|
|
|
- name: 'supTypeName',
|
|
|
- title: mixins.$t("supplierType"),
|
|
|
- type: 'drop',
|
|
|
- dropType: 'supType',
|
|
|
- // type: 'choose',
|
|
|
- // urlKey: 'chooseSupplierCategory',
|
|
|
- required: true,
|
|
|
- readonly: true,
|
|
|
- changeObj: {
|
|
|
- [Constants.kindCode.supplierPur]: {
|
|
|
- hide: ['serviceCategorie'],
|
|
|
- visible: ['brandId']
|
|
|
- },
|
|
|
- [Constants.kindCode.supplierOutsourcing]: {
|
|
|
- hide: ['serviceCategorie'],
|
|
|
- visible: ['brandId']
|
|
|
- },
|
|
|
- [Constants.kindCode.supplierService]: {
|
|
|
- hide: ['brandId'],
|
|
|
- visible: ['serviceCategorie']
|
|
|
- }
|
|
|
+ code: 'supName',
|
|
|
+ type: 'textarea',
|
|
|
+ title: mixins.$t("supplierName"),
|
|
|
+ required: true,
|
|
|
+ }, { //供应商类别
|
|
|
+ code: 'supType',
|
|
|
+ name: 'supTypeName',
|
|
|
+ title: mixins.$t("supplierType"),
|
|
|
+ type: 'drop',
|
|
|
+ dropType: 'supType',
|
|
|
+ // type: 'choose',
|
|
|
+ // urlKey: 'chooseSupplierCategory',
|
|
|
+ required: true,
|
|
|
+ readonly: true,
|
|
|
+ changeObj: {
|
|
|
+ [Constants.kindCode.supplierPur]: {
|
|
|
+ hide: ['serviceCategorie'],
|
|
|
+ visible: ['brandId']
|
|
|
+ },
|
|
|
+ [Constants.kindCode.supplierOutsourcing]: {
|
|
|
+ hide: ['serviceCategorie'],
|
|
|
+ visible: ['brandId']
|
|
|
},
|
|
|
- }, { //供应品牌
|
|
|
- code: 'brandId',
|
|
|
- name: 'brandName',
|
|
|
- title: mixins.$t("brandId"),
|
|
|
- type: 'choose',
|
|
|
- urlKey: 'chooseBrandy',
|
|
|
- }, { //服务类别
|
|
|
- code: 'serviceCategorie',
|
|
|
- name: 'serviceCategoriesName',
|
|
|
- title: mixins.$t("ServiceCategories"),
|
|
|
- type: 'choose',
|
|
|
- urlKey: 'chooseServiceCategory',
|
|
|
- }, { //联系人
|
|
|
- code: 'contactName',
|
|
|
- type: 'textarea',
|
|
|
- title: mixins.$t("contactName"),
|
|
|
+ [Constants.kindCode.supplierService]: {
|
|
|
+ hide: ['brandId'],
|
|
|
+ visible: ['serviceCategorie']
|
|
|
+ }
|
|
|
},
|
|
|
- { //联系电话
|
|
|
- code: 'contactPhone',
|
|
|
- type: 'phone',
|
|
|
- title: mixins.$t("contactPhone"),
|
|
|
+ }, { //供应品牌
|
|
|
+ code: 'brandId',
|
|
|
+ name: 'brandName',
|
|
|
+ title: mixins.$t("brandId"),
|
|
|
+ type: 'choose',
|
|
|
+ urlKey: 'chooseBrandy',
|
|
|
+ }, { //服务类别
|
|
|
+ code: 'serviceCategorie',
|
|
|
+ name: 'serviceCategoriesName',
|
|
|
+ title: mixins.$t("ServiceCategories"),
|
|
|
+ type: 'choose',
|
|
|
+ urlKey: 'chooseServiceCategory',
|
|
|
+ }, { //联系人
|
|
|
+ code: 'contactName',
|
|
|
+ type: 'textarea',
|
|
|
+ title: mixins.$t("contactName"),
|
|
|
+ },
|
|
|
+ { //联系电话
|
|
|
+ code: 'contactPhone',
|
|
|
+ type: 'phone',
|
|
|
+ title: mixins.$t("contactPhone"),
|
|
|
|
|
|
- }, {
|
|
|
- code: 'returnAddress',
|
|
|
- type: 'address',
|
|
|
- title: mixins.$t("returnAddress"),
|
|
|
- }
|
|
|
+ }, {
|
|
|
+ code: 'returnAddress',
|
|
|
+ type: 'address',
|
|
|
+ title: mixins.$t("returnAddress"),
|
|
|
+ }
|
|
|
]
|
|
|
formData.supType = Constants.kindCode.supplierOutsourcing// "供应商类别-外协"
|
|
|
formData.supTypeName = mixins.$t("outsourcingSupplier") //"外协供应商"
|
|
|
|
|
|
} else if (this.data.gradeCode == Constants.gradeCode.PRO) { //专业
|
|
|
contentObj.main = [{ //供应商名称
|
|
|
- code: 'supName',
|
|
|
- type: 'textarea',
|
|
|
- title: mixins.$t("supplierName"),
|
|
|
- required: true,
|
|
|
- }, { //供应商类别
|
|
|
- code: 'supType',
|
|
|
- name: 'supTypeName',
|
|
|
- title: mixins.$t("supplierType"),
|
|
|
- type: 'drop',
|
|
|
- dropType: 'supType',
|
|
|
- // type: 'choose',
|
|
|
- // urlKey: 'chooseSupplierCategory',
|
|
|
- required: true,
|
|
|
- changeObj: {
|
|
|
- [Constants.kindCode.supplierPur]: {
|
|
|
- hide: ['serviceCategorie'],
|
|
|
- visible: ['brandId']
|
|
|
- },
|
|
|
- [Constants.kindCode.supplierOutsourcing]: {
|
|
|
- hide: ['serviceCategorie'],
|
|
|
- visible: ['brandId']
|
|
|
- },
|
|
|
- [Constants.kindCode.supplierService]: {
|
|
|
- hide: ['brandId'],
|
|
|
- visible: ['serviceCategorie']
|
|
|
- }
|
|
|
+ code: 'supName',
|
|
|
+ type: 'textarea',
|
|
|
+ title: mixins.$t("supplierName"),
|
|
|
+ required: true,
|
|
|
+ }, { //供应商类别
|
|
|
+ code: 'supType',
|
|
|
+ name: 'supTypeName',
|
|
|
+ title: mixins.$t("supplierType"),
|
|
|
+ type: 'drop',
|
|
|
+ dropType: 'supType',
|
|
|
+ // type: 'choose',
|
|
|
+ // urlKey: 'chooseSupplierCategory',
|
|
|
+ required: true,
|
|
|
+ changeObj: {
|
|
|
+ [Constants.kindCode.supplierPur]: {
|
|
|
+ hide: ['serviceCategorie'],
|
|
|
+ visible: ['brandId']
|
|
|
+ },
|
|
|
+ [Constants.kindCode.supplierOutsourcing]: {
|
|
|
+ hide: ['serviceCategorie'],
|
|
|
+ visible: ['brandId']
|
|
|
},
|
|
|
- }, { //供应品牌
|
|
|
- code: 'brandId',
|
|
|
- name: 'brandName',
|
|
|
- title: mixins.$t("brandId"),
|
|
|
- type: 'choose',
|
|
|
- urlKey: 'chooseBrandy',
|
|
|
- }, { //服务类别
|
|
|
- code: 'serviceCategorie',
|
|
|
- name: 'serviceCategoriesName',
|
|
|
- title: mixins.$t("ServiceCategories"),
|
|
|
- type: 'choose',
|
|
|
- urlKey: 'chooseServiceCategory',
|
|
|
- }, { //联系人
|
|
|
- code: 'contactName',
|
|
|
- type: 'textarea',
|
|
|
- title: mixins.$t("contactName"),
|
|
|
+ [Constants.kindCode.supplierService]: {
|
|
|
+ hide: ['brandId'],
|
|
|
+ visible: ['serviceCategorie']
|
|
|
+ }
|
|
|
},
|
|
|
- { //联系电话
|
|
|
- code: 'contactPhone',
|
|
|
- type: 'phone',
|
|
|
- title: mixins.$t("contactPhone"),
|
|
|
+ }, { //供应品牌
|
|
|
+ code: 'brandId',
|
|
|
+ name: 'brandName',
|
|
|
+ title: mixins.$t("brandId"),
|
|
|
+ type: 'choose',
|
|
|
+ urlKey: 'chooseBrandy',
|
|
|
+ }, { //服务类别
|
|
|
+ code: 'serviceCategorie',
|
|
|
+ name: 'serviceCategoriesName',
|
|
|
+ title: mixins.$t("ServiceCategories"),
|
|
|
+ type: 'choose',
|
|
|
+ urlKey: 'chooseServiceCategory',
|
|
|
+ }, { //联系人
|
|
|
+ code: 'contactName',
|
|
|
+ type: 'textarea',
|
|
|
+ title: mixins.$t("contactName"),
|
|
|
+ },
|
|
|
+ { //联系电话
|
|
|
+ code: 'contactPhone',
|
|
|
+ type: 'phone',
|
|
|
+ title: mixins.$t("contactPhone"),
|
|
|
|
|
|
- }, {
|
|
|
- code: 'returnAddress',
|
|
|
- type: 'address',
|
|
|
- title: mixins.$t("returnAddress"),
|
|
|
- }
|
|
|
+ }, {
|
|
|
+ code: 'returnAddress',
|
|
|
+ type: 'address',
|
|
|
+ title: mixins.$t("returnAddress"),
|
|
|
+ }
|
|
|
]
|
|
|
formData.supType = Constants.kindCode.supplierPur//"供应商类别-采购"
|
|
|
formData.supTypeName = mixins.$t("procurementSupplier") //采购供应商"
|
|
|
- }
|
|
|
- //默认按照 采购供应商的显示显隐
|
|
|
+ }
|
|
|
+ //默认按照 采购供应商的显示显隐
|
|
|
this.setData({
|
|
|
contentObj: contentObj,
|
|
|
formData: JSON.stringify(formData)
|
|
|
})
|
|
|
- let changeObj = {
|
|
|
+ let changeObj = {
|
|
|
[Constants.kindCode.supplierPur]: {
|
|
|
hide: ['serviceCategorie'],
|
|
|
visible: ['brandId']
|
|
|
@@ -433,10 +435,10 @@ Page({
|
|
|
visible: ['serviceCategorie']
|
|
|
}
|
|
|
}
|
|
|
- const myComponent = this.selectComponent('#'+this.data.formName);
|
|
|
+ const myComponent = this.selectComponent('#' + this.data.formName);
|
|
|
// 四个参数(1.contentObj 要改变的对象列表 2. 对象列表需要改变的块名 3.改变块 里的 changeObj 改变规则 4.规则里的 规则名)
|
|
|
- myComponent.defaultvisibleOrHide(contentObj,'main',changeObj,Constants.kindCode.supplierPur);
|
|
|
-
|
|
|
+ myComponent.defaultvisibleOrHide(contentObj, 'main', changeObj, Constants.kindCode.supplierPur);
|
|
|
+
|
|
|
if (this.data.formMode == Constants.formMode.edit) {
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: mixins.$t('supplierEdit'),
|