Przeglądaj źródła

1、增加选择页面共通组件

zhoux 2 lat temu
rodzic
commit
ca1e66fa1f

+ 3 - 3
api/pages/ivt/outboundOther.js

@@ -18,11 +18,11 @@ module.exports = {
   routeUrl: {
     outboundOther: { 
       chooseSupplier: { key: 'chooseSupplier', url: '/package-base-select/pages/select-suppliers/select-suppliers'  },
-      chooseStaff: { key: 'chooseStaff', url: '/package-base-select/pages/select-choose-staff/select-choose-staff'  },
+      chooseStaff: { key: 'chooseStaff', url: '/package-base-select/pages/select-data/select-data',type:'staff'  },
       staffadd: { key: 'staffadd', url: '/package-basic-data/pages/staff/add/add'  },
-      chooseOrg: { key: 'chooseOrg',url: '/package-base-select/pages/select-choose-org/select-choose-org' }, 
+      chooseOrg: { key: 'chooseOrg',url: '/package-base-select/pages/select-data/select-data',type:'org' }, 
       chooseWh: { key: 'chooseWh', url: '/package-base-select/pages/select-warehouse/select-warehouse'  },      
-      chooseStorageObject: { key: 'chooseStorageObject', url: '/package-base-select/pages/select-storage-object/select-storage-object'  },
+      chooseStorageObject: { key: 'chooseStorageObject', url: '/package-base-select/pages/select-data/select-data',type:'objectType'  },
       chooseStorageOutReason: { key: 'chooseStorageOutReason', url: '/package-base-select/pages/select-data-dictionary/select-data-dictionary'  },
       openingInventory: { key: 'openingInventory', url: '/package-base-select/pages/select-warehouse/select-warehouse'  },
     }

+ 1 - 0
app.json

@@ -192,6 +192,7 @@
                 "pages/select-data-kind/select-data-kind",
                 "pages/select-data-dictionary/select-data-dictionary",
                 "pages/select-storage-object/select-storage-object",
+                "pages/select-data/select-data",
                 "pages/select-storage-in-reason/select-storage-in-reason",
                 "pages/select-staff-right/select-staff-right",
                 "pages/select-staff-purview/select-staff-purview",

+ 4 - 4
components/dkbase/dk-form-bill/dk-form-bill.js

@@ -377,9 +377,8 @@ Component({
 
         // 跳转链接
         if (item.item.urlKey) {
-          let url = this.data.routeUrl[this.data.routeObjName][item.item.urlKey].url
-          // TODO
-          // url = '/package-base-select/pages/select-customers/select-customers'
+          let route = this.data.routeUrl[this.data.routeObjName][item.item.urlKey]
+          let url = route.url
           if (url) {
             wx.navigateTo({
               url: url,
@@ -407,7 +406,8 @@ Component({
               },
               success: function (res) {
                 // 通过eventChannel向被打开页面传送数据
-                res.eventChannel.emit('params', { item: item.item })
+                console.log('rrre',route.type);
+                res.eventChannel.emit('params', { item: item.item, route:route})
               }
             })
           }

+ 7 - 6
components/dkbase/dk-form-more-items/dk-form-more-items.js

@@ -203,7 +203,8 @@ Component({
       console.log("cardList", cardList);
       // 跳转链接
       if (cardList && cardList[cardIndex] && cardList[cardIndex].urlKey) {
-        let url = this.data.routeUrl[this.data.routeObjName][cardList[cardIndex].urlKey].url
+        let route = this.data.routeUrl[this.data.routeObjName][cardList[cardIndex].urlKey]
+        let url = route.url
         if (url) {
           let that = this
           wx.navigateTo({
@@ -218,7 +219,7 @@ Component({
                 // that.setData({
                 //   form: form
                 // })
-                // console.log('form', form)
+                console.log('form1')
                 that.triggerEvent("chooseData", { code: cardList[cardIndex].name, data: data, index: item.index })
                 // // 如果需要联动控制选商品按钮
                 // if (item.item.controlChooseFlag) {
@@ -232,7 +233,7 @@ Component({
               // 通过eventChannel向被打开页面传送数据
               let item = {}
               item[that.data.objIdCol] = that.data.form[that.data.objIdCol]
-              res.eventChannel.emit('params', { item: item })
+              res.eventChannel.emit('params', { item: item ,route: route})
             }
           })
         }
@@ -424,7 +425,8 @@ Component({
       } else if (item.item.type == 'choose') {
         // 跳转链接
         if (item.item.urlKey) {
-          let url = this.data.routeUrl[this.data.routeObjName][item.item.urlKey].url
+          let route = this.data.routeUrl[this.data.routeObjName][item.item.urlKey]
+          let url = route.url
           if (url) {
             wx.navigateTo({
               url: url,
@@ -432,7 +434,6 @@ Component({
                 // 回调后
                 bindData: function (data) {
                   //处理明细 给明细赋值  例如选仓库回调赋值
-                  console.log('rrr', item);
                   let form = that.data.form
                   if (item.card == 'items') {
                     form[that.data.itemName][item.index][item.item.code] = data.data.id
@@ -456,7 +457,7 @@ Component({
               },
               success: function (res) {
                 // 通过eventChannel向被打开页面传送数据
-                res.eventChannel.emit('params', { item: item.item })
+                res.eventChannel.emit('params', { item: item.item, route: route })
               }
             })
           }

+ 57 - 35
components/dkbase/dk-list/dk-list.js

@@ -41,11 +41,11 @@ Component({
       value: true
     },
     // 副标题
-    subTitle:{
+    subTitle: {
       type: String,
     },
     // 副标题(格式化日期)
-    flgSubFormatDate:{
+    flgSubFormatDate: {
       type: Boolean,
       value: false
     },
@@ -55,12 +55,12 @@ Component({
       value: []
     },
     // 内容(不定)
-    contentObj:{
+    contentObj: {
       type: Object,
     },
     // 不定列的列名
-    contentCol:{
-      type:String,
+    contentCol: {
+      type: String,
     },
     // 底部信息
     footerInfo: {
@@ -71,8 +71,8 @@ Component({
       type: Object
     },
     // 底部tag的名称
-    footerTag:{
-      type:String,
+    footerTag: {
+      type: String,
     },
     // 按钮信息
     buttonList: {
@@ -83,48 +83,53 @@ Component({
       type: String
     },
     // 金额字段
-    collectCol:{
-      type:String
+    collectCol: {
+      type: String
     },
     // 金额对应的描述字段
-    collectName:{
-      type:String
+    collectName: {
+      type: String
     },
-    titleImageFlag:{ //标题图片显示隐藏
+    titleImageFlag: { //标题图片显示隐藏
       type: Boolean,
       value: true
     },
-    statusFlag:{ //状态显示隐藏
+    // 是否显示选择框
+    chooseFlag: { //标题图片显示隐藏
+      type: Boolean,
+      value: false
+    },
+    statusFlag: { //状态显示隐藏
       type: Boolean,
       value: true
     },
 
-    switchFlag:{ //启用停用状态
+    switchFlag: { //启用停用状态
       type: Boolean,
-      value: false 
+      value: false
     },
-    swipeDisabled:{ //侧滑  默认禁用  false开启
+    swipeDisabled: { //侧滑  默认禁用  false开启
       type: Boolean,
-      value: true 
+      value: true
     },
     // 是否侧滑删除  (删除,启用/停用)
-    swipeDeleteFlag:{
+    swipeDeleteFlag: {
       type: Boolean,
-      value: false 
+      value: false
     },
-    subMainTitle:{ //主标题右侧文本 value
-      type: String 
+    subMainTitle: { //主标题右侧文本 value
+      type: String
     },
-    subMainTitlelabel:{ //主标题右侧文本 label
-      type: String 
+    subMainTitlelabel: { //主标题右侧文本 label
+      type: String
     },
 
-    defaultFlagKey:{ //默认key
-      type: String 
+    defaultFlagKey: { //默认key
+      type: String
     },
-    defaultFlag:{ //开启默认
+    defaultFlag: { //开启默认
       type: Boolean,
-      value: false 
+      value: false
     },
   },
 
@@ -143,17 +148,34 @@ Component({
    * 组件的方法列表
    */
   methods: {
-     /**
-     * @desc   : 打电话
+    /**
+     * @desc   : 选择数据
      * @author : 周兴
      * @date   : 2024/2/19 11:46
      */
+    chooseData(e) {
+      let list = this.data.list;
+      let index = e.currentTarget.dataset.index
+      if (list && list[index]) {
+        list[index].checked = !list[index].checked
+      }
+      this.setData({
+        list: list
+      })
+      // 勾选数据
+      this.triggerEvent("choose", { list: list.filter(it=>it.checked) })
+    },
+    /**
+    * @desc   : 打电话
+    * @author : 周兴
+    * @date   : 2024/2/19 11:46
+    */
     openTelPhone(e) {
-      if(!e.currentTarget.dataset.phone){
+      if (!e.currentTarget.dataset.phone) {
         return;
       }
       let tel = e.currentTarget.dataset.value
-      if(!tel){
+      if (!tel) {
         return;
       }
       wx.makePhoneCall({
@@ -190,7 +212,7 @@ Component({
      * @date   : 2024/1/26 11:46
      */
     toPoint(e) {
-      this.triggerEvent("toPoint", {item:e.currentTarget.dataset.item})
+      this.triggerEvent("toPoint", { item: e.currentTarget.dataset.item })
       this.setData({
         show: true,
         item: e.currentTarget.dataset.item
@@ -202,9 +224,9 @@ Component({
      * @date   : 2024/1/26 11:46
      */
     clickButton(e) {
-      console.log('点击按钮',e,this.data.item)
+      console.log('点击按钮', e, this.data.item)
       let item = this.data.item;
-      item = Object.assign(item,{button:e.currentTarget.dataset.item})
+      item = Object.assign(item, { button: e.currentTarget.dataset.item })
       let obj = {
         item: item,
         name: e.currentTarget.dataset.item.name,
@@ -220,7 +242,7 @@ Component({
      * @author : 于继渤
      * @date   : 2024/1/26 11:46
      */
-    onCloseSwipe(e){
+    onCloseSwipe(e) {
       let obj = {
         item: e.currentTarget.dataset.item,
         index: e.currentTarget.dataset.index

+ 9 - 7
components/dkbase/dk-list/dk-list.wxml

@@ -1,6 +1,6 @@
 <wxs src='../../../utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
 <view wx:for="{{list}}" data-item="{{item}}" wx:key="index" class="main-class">
-  <van-swipe-cell right-width="{{ 65 }}"  disabled="{{swipeDisabled}}" data-index="{{index}}" data-item="{{item}}" bind:click="onCloseSwipe" >
+  <van-swipe-cell right-width="{{ 65 }}" disabled="{{swipeDisabled}}" data-index="{{index}}" data-item="{{item}}" bind:click="onCloseSwipe">
     <view class="main-foot" style="position: relative;">
       <view class="corner-view" wx:if="{{item[titleCorner]}}">
         <view class="corner-view-text">{{item[titleCorner]}}</view>
@@ -16,27 +16,29 @@
                 <van-image round width="20rpx" height="24rpx" src="{{'/static/img/' + titleImage}}" />
               </view>
             </view>
+            <!-- 选择框-->
+            <van-checkbox wx:if="{{chooseFlag}}" checked-color="#E4002B" value="{{ item.checked }}" data-index="{{index}}" catchtap="chooseData"></van-checkbox>
             <!-- 标题 -->
-            <view class="title-class" style="width: 50%;">
+            <view class="title-class" style="width: {{(statusFlag &&  item[status] || switchFlag || flgPoint)?'50%':'100%'}}">
               <dk-text catchtap="toTitle" data-item="{{item}}" textDecoration="underline" fontSize="15px" value="{{item[title]}}"></dk-text>
             </view>
 
             <view style="width: auto;" wx:if="{{subMainTitle}}">
-              <dk-text  data-item="{{item}}" textDecoration="underline" fontSize="15px" value="{{subMainTitlelabel + item[subMainTitle]}}"></dk-text>
+              <dk-text data-item="{{item}}" textDecoration="underline" fontSize="15px" value="{{subMainTitlelabel + item[subMainTitle]}}"></dk-text>
             </view>
             <view wx:if="{{defaultFlag &&  item[defaultFlagKey]}}">
-              <view class="status-detail-class-flg-default" >{{'默认'}}
+              <view class="status-detail-class-flg-default">{{'默认'}}
               </view>
             </view>
 
-        
+
             <!-- 状态 -->
             <view wx:if="{{statusFlag &&  item[status]}}" class="status-class" data-item="{{item}}" catchtap="toStatus">
               <view class="status-detail-class" style="{{item.backgroundColor?'background-color:' + item.backgroundColor:null }}">{{item[status]}}
               </view>
             </view>
             <!-- 启用/停用标识-->
-            <view wx:if="{{switchFlag}}" style="text-align: right;" >
+            <view wx:if="{{switchFlag}}" style="text-align: right;">
               <view class="status-detail-class" style="{{item['flgValid'] ? 'width: 56rpx' : 'background-color:red;width: 56rpx;'}}">{{item['flgValid'] ? $t['enable'] : $t['disable']}}
               </view>
             </view>
@@ -98,7 +100,7 @@
               {{wxmlUtil.setFooterItemValue(item,footerInfo)}}
             </view>
             <view class="footer-tag-class" wx:if="{{footerTag && item[footerTag]}}">
-              <dk-tag border="1rpx solid #00A7B5" height="44rpx" color="transparent" textColor="#00A7B5" radius="10rpx" roundFlag="{{true}}"  value="{{item[footerTag]}}"></dk-tag>
+              <dk-tag border="1rpx solid #00A7B5" height="44rpx" color="transparent" textColor="#00A7B5" radius="10rpx" roundFlag="{{true}}" value="{{item[footerTag]}}"></dk-tag>
             </view>
             <view class="totalamount-class" wx:else>
               <dk-cell center="{{(footerInfo && footerInfo.length > 0)?'space-around':'space-between'}}" contentRight="{{true}}" fontSize="15" contentFontSize="17" contentColor="#CAA977" titleColor="#1B365D;" contentFontWeight="bold" title="{{footerAmount.title}}" content="{{item[footerAmount.name]}}"></dk-cell>

+ 6 - 1
mixins/index.js

@@ -632,6 +632,7 @@ module.exports = {
     formMode = formMode ? formMode : Constants.formMode.index
     // 列表
     if (formMode == Constants.formMode.index) {
+      console.log('td');
       // 默认查询
       this.searchData();
       // 编辑
@@ -718,7 +719,11 @@ module.exports = {
             chooseData: data
           })
         }
-        console.log('t2', data);
+        if (data.route) {
+          _this.setData({
+            chooseRoute: data.route
+          })
+        }
         // 加载后续数据
         _this.handleLoadData();
         // 页面设置初始信息

+ 12 - 0
utils/Constants.js

@@ -64,6 +64,18 @@ module.exports = {
     staff: 'staff'
   },
 
+  // 选择页面的类型
+  chooseType:{
+    // 部门
+    org:'org',
+    // 对象类别
+    objectType:'objectType',
+    // 员工
+    staff:'staff',
+    // 数据字典
+    dictionary:'dictionary'
+  },
+
   // 表单类型
   gradeCode: {
     // 标准版