Browse Source

供应商

wangyingjie 2 years ago
parent
commit
00550b1cfd

+ 1 - 1
api/pages/common/common.js

@@ -23,7 +23,7 @@ module.exports = {
         unitListBy: 'unit_list_by', //计量单位
         warehouseListBy: 'get_warehouse_by_page', //仓库档案
         getDictionaryData: 'get_dictionary_data', //数据字典
-        getDataKind: 'get_data_kind', //数据字典
+        getDataKind: 'get_data_kind', //系统数据
         getStaff: 'get_staff', //员工
         getOrg: 'get_org', //业务部门
         getGoodsCategoryNoPage: 'get_goods_category_no_page', //商品种类不带分页 

+ 5 - 1
api/pages/mst/supplier.js

@@ -16,7 +16,11 @@ module.exports = {
   routeUrl: {
     supplier: { 
       add: { key: 'add', url: '/package-purchase/pages/supplier-list/add/add'  },
-      chooseSupplier: { key: 'chooseSupplier', url: '/package-base-select/pages/select-data/select-data',type:'supplier'  },
+      chooseSupplierCategory: { key: 'chooseSupplierCategory', url: '/package-base-select/pages/select-data/select-data',type:'kindData', kindType:'供应商类别' },
+      chooseServiceCategory: { key: 'chooseServiceCategory', url: '/package-base-select/pages/select-data/select-data',type:'kindData', kindType:'服务类别' , chooseFlag:'ture' },
+      chooseStaff: { key: 'chooseStaff', url: '/package-base-select/pages/select-data/select-data',type:'staff'  },
+      chooseOrg: { key: 'chooseOrg',url: '/package-base-select/pages/select-data/select-data',type:'org' }, 
+      chooseBrandy: { key: 'chooseBrandy',url: '/package-base-select/pages/select-data/select-data',type:'brand', chooseFlag:'ture'}, 
     }
   }
 };

+ 148 - 71
package-base-select/pages/select-data/select-data.js

@@ -86,16 +86,16 @@ Page({
             let choosedData = this.data.choosedData
             // 不允许重复
             if (!this.data.repeatFlag) {
-                if (e.detail.checked) {  // 勾选
+                if (e.detail.checked) { // 勾选
                     let filters = choosedData.filter(it => it[valueKey] == item[valueKey])
-                    if(!filters || filters.length == 0){
+                    if (!filters || filters.length == 0) {
                         choosedData.push(item);
                     }
-                } else {                 // 取消勾选
+                } else { // 取消勾选
                     choosedData = choosedData.filter(it => it[valueKey] != item[valueKey])
                 }
             } else {
-                if (e.detail.checked) {  // 勾选
+                if (e.detail.checked) { // 勾选
                     // 可以重复
                     choosedData.push(item);
                 }
@@ -116,7 +116,11 @@ Page({
         let name = list.map(it => it[this.data.labelKey])
         const eventChannel = this.getOpenerEventChannel();
         eventChannel.emit('bindData', {
-            data: { list, id, name }
+            data: {
+                list,
+                id,
+                name
+            }
         })
         wx.navigateBack({
             delta: 1
@@ -144,14 +148,14 @@ Page({
                     name: item.orgName
                 }
                 break;
-            // 员工
+                // 员工
             case Constants.chooseType.staff:
                 data = {
                     id: item.staffId,
                     name: item.staffName
                 }
                 break;
-            // 供应商
+                // 供应商
             case Constants.chooseType.supplier:
                 data = {
                     id: item.supId,
@@ -159,7 +163,7 @@ Page({
                     item: item
                 }
                 break;
-            // 对象类型
+                // 对象类型
             case Constants.chooseType.objectType:
                 data = {
                     id: item.objId,
@@ -168,14 +172,28 @@ Page({
                 }
                 break;
 
-            // 仓库
+                // 仓库
             case Constants.chooseType.warehouse:
                 data = {
                     id: item.whId,
                     name: item.whName
                 }
                 break;
-            // 数据字典
+                    // 品牌
+            case Constants.chooseType.brand:
+                data = {
+                    id: item.brandId,
+                    name: item.brandName
+                }
+                break;
+                // 系统数据
+            case Constants.chooseType.kindData:
+                data = {
+                    id: item.kindCode,
+                    name: item.kindName
+                }
+                break;
+                // 数据字典
             case Constants.chooseType.dictionary:
                 data = {
                     id: item.dataId,
@@ -185,6 +203,16 @@ Page({
                     flgDefault: item.flgDefault,
                 }
                 break;
+                // 系统数据
+            case Constants.chooseType.kindType:
+                data = {
+                    id: item.id,
+                    name: item.kindName,
+                    kindType: item.kindType,
+                    kindCode: item.kindCode,
+                    flgDefault: item.flgDefault,
+                }
+                break;
             default:
                 data = {}
                 break;
@@ -207,6 +235,10 @@ Page({
         if (this.data.dictCode) {
             params.dictCode = this.data.dictCode
         }
+        // 系统数据
+        if (this.data.kindType) {
+            params.kindType = this.data.kindType
+        }
         let chooseType = this.data.chooseRoute.type;
         // 供应商
         if (chooseType == Constants.chooseType.supplier) {
@@ -225,11 +257,11 @@ Page({
      * @date : 2024年3月26日
      * @author : 周兴
      */
-    delChoosed(e){
-        let choosedData= this.data.choosedData;
-        choosedData = choosedData.filter((it,index)=>index != e.detail.index)
+    delChoosed(e) {
+        let choosedData = this.data.choosedData;
+        choosedData = choosedData.filter((it, index) => index != e.detail.index)
         this.setData({
-            choosedData:choosedData
+            choosedData: choosedData
         })
     },
     /** 
@@ -290,11 +322,11 @@ Page({
                     contentList: [{
                         name: 'orgCode',
                         title: '部门编码'
-                    },],
+                    }, ],
                     placeholder: ['orgName']
                 })
                 break;
-            // 员工
+                // 员工
             case Constants.chooseType.staff:
                 title = "员工"
                 this.setData({
@@ -303,18 +335,18 @@ Page({
                     method: 'getStaff',
                     title: 'staffName',
                     contentList: [{
-                        name: 'staffCode',
-                        title: '员工编码'
-                    },
-                    {
-                        name: 'orgName',
-                        title: '部门'
-                    },
+                            name: 'staffCode',
+                            title: '员工编码'
+                        },
+                        {
+                            name: 'orgName',
+                            title: '部门'
+                        },
                     ],
                     placeholder: ['staffName']
                 })
                 break;
-            // 供应商
+                // 供应商
             case Constants.chooseType.supplier:
                 title = "供应商"
                 this.setData({
@@ -326,13 +358,13 @@ Page({
                     labelKey: 'supName',
                     chooseFlag: route.chooseFlag,
                     contentList: [{
-                        name: 'supTypeName',
-                        title: '供应商类别'
-                    },
-                    {
-                        name: 'returnAddress',
-                        title: '供应商地址'
-                    },
+                            name: 'supTypeName',
+                            title: '供应商类别'
+                        },
+                        {
+                            name: 'returnAddress',
+                            title: '供应商地址'
+                        },
                     ],
                     placeholder: ['supplier']
                 })
@@ -349,7 +381,7 @@ Page({
                     })
                 }
                 break;
-            // 仓库
+                // 仓库
             case Constants.chooseType.warehouse:
                 title = "仓库"
                 this.setData({
@@ -358,18 +390,40 @@ Page({
                     method: 'warehouseListBy',
                     title: 'whName',
                     contentList: [{
-                        name: 'supervisor',
-                        title: '仓库主管'
-                    },
-                    {
-                        name: 'contactPhone',
-                        title: '联系电话'
-                    },
+                            name: 'supervisor',
+                            title: '仓库主管'
+                        },
+                        {
+                            name: 'contactPhone',
+                            title: '联系电话'
+                        },
                     ],
                     placeholder: ['whName']
                 })
                 break;
-            // 数据字典
+                // 品牌
+            case Constants.chooseType.brand:
+                title = "品牌"
+                this.setData({
+                    addUrl: '/package-basic-data/pages/basic-data/basic-data',
+                    routeObjName: 'common',
+                    method: 'goodsBrandListBy',
+                    chooseFlag: route.chooseFlag,
+                    repeatFlag: route.repeatFlag,
+                    title: 'brandName',
+                    contentList: [{
+                            name: 'brandCode',
+                            title: '品牌编码'
+                        },
+                        {
+                            name: 'brandName',
+                            title: '品牌名称'
+                        },
+                    ],
+                    placeholder: ['brandName']
+                })
+                break;
+                // 数据字典
             case Constants.chooseType.dictionary:
                 title = "数据字典"
                 this.setData({
@@ -382,18 +436,41 @@ Page({
                     valueKey: 'dataId',
                     title: 'dataValue',
                     contentList: [{
-                        name: 'dataCode',
-                        title: '数据编码'
-                    },
-                    {
-                        name: 'dictCode',
-                        title: '字典项目'
-                    },
+                            name: 'dataCode',
+                            title: '数据编码'
+                        },
+                        {
+                            name: 'dictCode',
+                            title: '字典项目'
+                        },
                     ],
                     placeholder: ['orgName']
                 })
                 break;
-            // 对象类型
+                // 系统数据
+            case Constants.chooseType.kindData:
+                title = "系统数据"
+                this.setData({
+                    routeObjName: 'common',
+                    method: 'getDataKind',
+                    kindType: route.kindType,
+                    valueKey: 'kindCode',
+                    title: 'kindName',
+                    chooseFlag: route.chooseFlag,
+                    repeatFlag: route.repeatFlag,
+                    contentList: [{
+                            name: 'kindCode',
+                            title: '数据代码'
+                        },
+                        {
+                            name: 'kindName',
+                            title: '数据名称'
+                        },
+                    ],
+                    placeholder: ['sensitiveName']
+                })
+                break;
+                // 对象类型
             case Constants.chooseType.objectType:
                 title = "对象类型"
                 this.setData({
@@ -401,32 +478,32 @@ Page({
                     method: 'getSupplierAndCustomerData',
                     title: 'objName',
                     contentList: [{
-                        name: 'objCode',
-                        title: '对象编码'
-                    },
-                    {
-                        name: 'objTypeName',
-                        title: '对象'
-                    },
-                    {
-                        name: 'addressFull',
-                        title: '地址'
-                    },
+                            name: 'objCode',
+                            title: '对象编码'
+                        },
+                        {
+                            name: 'objTypeName',
+                            title: '对象'
+                        },
+                        {
+                            name: 'addressFull',
+                            title: '地址'
+                        },
                     ],
                     searchContent: [{
-                        code: 'supplier-customer',
-                        title: '选择对象',
-                        searchType: Constants.searchType.switch,
-                        list: [{
-                            code: 'supplier',
-                            title: '供应商'
+                            code: 'supplier-customer',
+                            title: '选择对象',
+                            searchType: Constants.searchType.switch,
+                            list: [{
+                                    code: 'supplier',
+                                    title: '供应商'
+                                },
+                                {
+                                    code: 'customer',
+                                    title: '客户'
+                                }
+                            ]
                         },
-                        {
-                            code: 'customer',
-                            title: '客户'
-                        }
-                        ]
-                    },
 
                     ],
                     placeholder: ['customerName', 'supplierName', 'address', 'telephone']

+ 59 - 10
package-purchase/pages/supplier-list/add/add.js

@@ -33,21 +33,21 @@ Page({
           name: 'supTypeName',
           title: mixins.$t("supplierType"),
           type: 'choose',
-          urlKey: 'chooseSupplier',
+          urlKey: 'chooseSupplierCategory',
           required: true,
           changeObj: { supplierPur: { hide: ['serviceCategorie'], visible: ['brandId'] }, supplierService: { hide: ['brandId'], visible: ['serviceCategorie'] } },
         }, { //供应品牌
           code: 'brandId',
           name: 'brandName',
           title: mixins.$t("brandId"),
-          type: 'mutidrop',
-          dropType: 'brand'
+          type: 'choose',
+          urlKey: 'chooseBrandy',  
         },  { //服务类别 
           code: 'serviceCategorie',
           name: 'serviceCategoriesName',
           title: mixins.$t("ServiceCategories"),
-          type: 'mutidrop',
-          dropType: 'serviceCategories'
+          type: 'choose',
+          urlKey: 'chooseServiceCategory', 
         }, { //联系人
           code: 'contactName',
           type: 'textarea',
@@ -65,14 +65,14 @@ Page({
         code: 'staffId', 
         name: 'staffName',
         title: mixins.$t("procureStaff"),
-        type: 'drop',
-        dropType: 'staff'
+        type: 'choose',
+        urlKey: 'chooseStaff'
       }, {  //业务部门
         code: 'orgId', 
         name: 'orgName',  
         title: mixins.$t("orgId"),
-        type: 'drop',
-        dropType: 'org'
+        type: 'choose',
+        urlKey: 'chooseOrg'
       }, { // todo: 目前 表里 缺这个字段 先不弄
         code: 'collectAmount',
         type: 'number',
@@ -88,7 +88,56 @@ Page({
     // 路由
     routeObjName: 'supplier',
   },
- 
+   /**
+      * @desc   : 绑定数据-选择页面返回的逻辑处理
+      * @author : 王英杰
+      * @date   : 2024年3月12日
+      */
+     chooseData(e) { 
+      console.log("t", e, this.data.formData);
+      let formData = JSON.parse(this.data.formData) 
+      let code = e.detail.code
+      let data = e.detail.data.data
+      if (code == "supType") { //供应商类别
+        formData.supType = data.id
+        formData.supTypeName = data.name
+      }
+      if (code == "serviceCategorie") { //供应商服务类别
+        let ids = []
+        let names = []
+        if(data && data.list){
+          data.list.forEach(element => {
+            ids.push(element.id)
+            names.push(element.kindName)
+          }); 
+        }
+        formData.serviceCategorie = ids.join(',')
+        formData.serviceCategoriesName = names.join(',')
+      } 
+      if (code == "staffId") { //员工
+        formData.staffId = data.id
+        formData.staffName = data.name
+      }
+      if (code == "orgId") { //部门
+        formData.orgId = data.id
+        formData.orgName = data.name
+      }
+      if (code == "brandId") { //供应商品牌
+        let ids = []
+        let names = []
+        if(data && data.list){
+          data.list.forEach(element => {
+            ids.push(element.brandId)
+            names.push(element.brandName)
+          }); 
+        }         
+        formData.brandId = ids.join(',')
+        formData.brandName = names.join(',')
+      } 
+      this.setData({  
+        formData: JSON.stringify(formData)
+      })
+    },
 
   /**
    * @desc : 给表单赋值

+ 1 - 1
package-purchase/pages/supplier-list/add/add.wxml

@@ -10,7 +10,7 @@
 </dk-form> -->
 
 <dk-form id="{{formName}}" cardList="{{cardList}}" contentObj="{{contentObj}}" 
-model:value="{{formData}}" bind:chooseData="chooseData"  >
+model:value="{{formData}}" bind:chooseData="chooseData" routeObjName ="{{routeObjName}}"  >
 </dk-form>
  
 <view style="height: 16vw;"></view>

+ 78 - 43
utils/Constants.js

@@ -1,6 +1,6 @@
 /**
-  * 导出常量
-  */
+ * 导出常量
+ */
 module.exports = {
   //一页条数
   PAGE_SIZE: 5,
@@ -9,7 +9,7 @@ module.exports = {
   // 默认语言
   lan: 'zh_CN',
   // 应用代码
-  APP_CODE:'CP-WXP',
+  APP_CODE: 'CP-WXP',
   //页面加载数据API
   BASIC_COMMON_API: "mdm-server/mst/common/",
   //供应商停用api
@@ -65,19 +65,23 @@ module.exports = {
   },
 
   // 选择页面的类型
-  chooseType:{
+  chooseType: {
     // 部门
-    org:'org',
+    org: 'org',
     // 对象类别
-    objectType:'objectType',
+    objectType: 'objectType',
     // 员工
-    staff:'staff',
+    staff: 'staff',
     // 供应商
-    supplier:'supplier',
+    supplier: 'supplier',
     // 数据字典
-    dictionary:'dictionary',
+    dictionary: 'dictionary',
+    // 系统数据
+    kindData: 'kindData',
     // 仓库
-    warehouse:'warehouse',
+    warehouse: 'warehouse',
+    // 品牌
+    brand: 'brand',
   },
 
   // 表单类型
@@ -107,30 +111,48 @@ module.exports = {
   },
 
   // 查询条件日期数据源
-  searchDateSource: [
-    { text: '本日', value: 1 },
-    { text: '本周', value: 2 },
-    { text: '本月', value: 3 },
-    { text: '本年', value: 4 },
-    { text: '近7天', value: 6 },
-    { text: '近30天', value: 5 },
-    { text: '自定义', value: -2 },
+  searchDateSource: [{
+      text: '本日',
+      value: 1
+    },
+    {
+      text: '本周',
+      value: 2
+    },
+    {
+      text: '本月',
+      value: 3
+    },
+    {
+      text: '本年',
+      value: 4
+    },
+    {
+      text: '近7天',
+      value: 6
+    },
+    {
+      text: '近30天',
+      value: 5
+    },
+    {
+      text: '自定义',
+      value: -2
+    },
   ],
 
-    // 收付款类型
-    rpType: {
-      receipt: '收付款类型-收款',
-      payment: '收付款类型-付款', 
-    }
-    ,
+  // 收付款类型
+  rpType: {
+    receipt: '收付款类型-收款',
+    payment: '收付款类型-付款',
+  },
 
   // 入库类型
   intoType: {
     pur: '入库类型-采购入库',
     saleReturn: '入库类型-销退入库',
     other: '入库类型-其他入库',
-  }
-  ,
+  },
 
   // 入库状态
   intoStatus: {
@@ -144,20 +166,17 @@ module.exports = {
     outBounded: '出库状态-已出库',
     outBounding: '出库状态-出库中',
     unOutBound: '出库状态-待出库',
-  }
-  ,
+  },
 
   // 出库类型
   outType: {
     purReturn: '出库类型-采退出库',
     sale: '出库类型-销售出库',
     other: '出库类型-其他出库',
-  }
-  ,
+  },
 
   // 出库进度
-  outStatusList: [
-    {
+  outStatusList: [{
       name: '未出库',
       code: '出库状态-未出',
       id: 0,
@@ -224,23 +243,23 @@ module.exports = {
     goodsAttr: '商品属性',
     basicData: '基础资料'
   },
-    /**
+  /**
    * @desc   : 订单状态
    * @author : 于继渤
    * @date   : 2024/3/9 16:17
    */
-  orderStatus:{
-    STATUS_DEAL:'订单状态-成交',
-    STATUS_STAGING:'订单状态-暂存',
-    STAGING:'暂存'
+  orderStatus: {
+    STATUS_DEAL: '订单状态-成交',
+    STATUS_STAGING: '订单状态-暂存',
+    STAGING: '暂存'
   },
   /**
    * @desc   : 单据类型
    * @author : 周兴
    * @date   : 2024/3/9 16:17
    */
-  documentType:{
-    purOrder:"单据类型-采购订单"
+  documentType: {
+    purOrder: "单据类型-采购订单"
   },
 
   /**
@@ -270,12 +289,28 @@ module.exports = {
   },
 
   // 收款进度
-  receiveStatusList: [{ name: '未收款', code: '收款状态-未收', id: 0, infotype: 'default' },
-  { name: '部分收款', code: '收款状态-部分', id: 1, infotype: 'default' },
-  { name: '收款完成', code: '收款状态-完成', id: 2, infotype: 'default' }],
+  receiveStatusList: [{
+      name: '未收款',
+      code: '收款状态-未收',
+      id: 0,
+      infotype: 'default'
+    },
+    {
+      name: '部分收款',
+      code: '收款状态-部分',
+      id: 1,
+      infotype: 'default'
+    },
+    {
+      name: '收款完成',
+      code: '收款状态-完成',
+      id: 2,
+      infotype: 'default'
+    }
+  ],
 
   //销售订单相关API
   SALE_ORDER_API: "order-server/wxapi/sale/order/",
   WARE_HOUSE: "mdm-server/mst/warehouse/",
   PAGE_ITEM_MUST_API: "basic-server/basic/pageItemMust",
-};
+};