Просмотр исходного кода

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss_wx_app

王英杰 1 год назад
Родитель
Сommit
31983fcd19

+ 10 - 2
mixins/index.js

@@ -35,6 +35,8 @@ module.exports = {
     functionCode: null,
     // 是否分页
     pageFlag: true,
+    // 是否回到上一界面
+    backFlag:false,
     // 分页
     pageInfo: {
       pageSize: Constants.PAGE_SIZE,
@@ -487,11 +489,12 @@ module.exports = {
         if (this.handleData) {
           this.handleData();
         }
-        console.log('this.data.formMode', this.data.formMode, this.data.navigateBackFlag);
+        console.log('this.data.formMode', this.data.formMode, this.data.navigateBackFlag,this.data.backFlag);
         //是否返回上一页
         if (!this.data.navigateBackFlag) {
           // 非新建页面回到上一个页面
-          if (this.data.formMode != Constants.formMode.add) {
+          if (this.data.formMode != Constants.formMode.add || this.data.backFlag) {
+            console.log('t3');
             // 给父页面传递数据
             const eventChannel = this.getOpenerEventChannel();
             eventChannel.emit('refresh', {
@@ -1124,6 +1127,11 @@ module.exports = {
             formType: data.formType
           })
         }
+        if(data.backFlag){
+          _this.setData({
+            backFlag: data.backFlag
+          })
+        }
         if (data.chooseType) {
           _this.setData({
             chooseData: data

+ 7 - 5
package-base-select/pages/select-data/select-data.js

@@ -70,14 +70,16 @@ Page({
       wx.navigateTo({
         url: this.data.addUrl,
         events: {
-          // // 回调后,在这里给页面赋值
-          // bandData: function (e) {
-
-          // }
+          // 保存成功后刷新页面
+          refresh: function (data) {
+            // 刷新一览界面
+            _this.searchData();
+          }
         },
         success: function (res) {
+          console.log('_this.data.chooseType',_this.data.chooseRoute);
           // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
-          res.eventChannel.emit('params', {})
+          res.eventChannel.emit('params', {formType:_this.data.chooseRoute.type,backFlag:true})
         }
       })
     }else if(this.data.popContent && this.data.popContent.length > 0){

+ 174 - 172
package-purchase/pages/supplier-list/add/add.js

@@ -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'),