瀏覽代碼

邀请员工

姜永辉 2 年之前
父節點
當前提交
56bf367ec3

+ 1 - 1
api/pages/mst/staff.js

@@ -11,7 +11,7 @@ module.exports = {
     staffService: {
         // 前缀
         prefix: 'mdm-server-dkic-b1/mst/staff/', 
-        
+        insertRequestStaff:'insert_request',
     },
 
     routeUrl: {

+ 1 - 0
i18n/zh-CN.js

@@ -214,6 +214,7 @@ const supplier = {
   serviceProvider: "服务供应商",
   meet: "应付",
   save: '保存',
+  confirm: '确定',
   returnAddress:'退货地址',
   serviceCategories:'服务类别'
 }

+ 36 - 3
mixins/index.js

@@ -50,6 +50,8 @@ module.exports = {
     formMode: null,
     // id
     id: null,
+    // other
+    other: null,
     // 当前数据
     item: null,
     // 语言包
@@ -86,7 +88,7 @@ module.exports = {
       loading: true
     })
     // 如果重新查询,需要nomore标识重置为false
-    if(e != 'more' && this.data.noMore){
+    if (e != 'more' && this.data.noMore) {
       this.setData({
         noMore: false
       })
@@ -104,9 +106,9 @@ module.exports = {
       if (res && res.data.code === Constants.SUCESS_CODE) {
         let tableData = this.data.tableData;
         let list = []
-        if(res.data.data && Array.isArray( res.data.data)){
+        if (res.data.data && Array.isArray(res.data.data)) {
           list = res.data.data;
-        }else{
+        } else {
           list = res.data.data.list
         }
         // 如果不是翻页,需要清空
@@ -422,6 +424,30 @@ module.exports = {
   detail(id) {
     return this.excute(this.data.service, id, null);
   },
+
+  /**
+   * @desc   : 查询明细的方法(不给外部调用)
+   * @author : 周兴
+   * @date   : 2022/12/8 17:56
+   */
+  _other(param) {
+    this.loading = true;
+    // 给参数赋值
+    let params = this._setSearchParams();
+    this._getData(params).then(res => {
+      if (res && res.data.code === Constants.SUCESS_CODE) {
+        console.log("_other", res);
+        // 给变量赋值
+        if (this.setValuesByEdit) {
+          this.setValuesByEdit(res.data.data)
+        }
+      }
+      setTimeout(() => {
+        this.loading = false
+      }, 300)
+    });
+
+  },
   /**
    * @desc : 执行方法
    * @author : 周兴
@@ -532,6 +558,12 @@ module.exports = {
         // 调用明细
         this._detail(id);
       }
+    } else if (formMode == Constants.formMode.other) {
+      let other = this.data.other;
+      if (other) {
+        // 调用
+        this._other(other);
+      }
     }
   },
   /**
@@ -567,6 +599,7 @@ module.exports = {
         if (data.formMode) {
           _this.setData({
             id: data.id,
+            other: data.other,
             formMode: data.formMode,
           })
         }

+ 1 - 1
package-basic-data/pages/staff/add/add.js

@@ -18,7 +18,7 @@ Page({
     cardList: ['main'],
     contentObj: {
       main: [
-        { code: 'staffCode', type: 'str', readonly:true, title: mixins.$t('staffCode') },
+        
         { code: 'staffName', type: 'str', required: true, title: mixins.$t('staffName') },
         { code: 'staffPhone', type: 'phone', title: mixins.$t('staffPhone'), required: true },
         { code: 'orgId', name: 'orgName', type: 'drop', required: true, dropType: 'org' },

+ 1 - 1
package-basic-data/pages/staff/add/add.wxml

@@ -7,6 +7,6 @@
 </dk-form>
 <!--  保存 -->
 <view class="bottom-class">
-  <van-button custom-class="save-button-class" disabled="{{loading}}" loading="{{loading}}" bind:click="save" type="default">保存
+  <van-button custom-class="save-button-class" disabled="{{loading}}" loading="{{loading}}" bind:click="save" type="default">{{$t['save']}}
   </van-button>
 </view>

+ 8 - 17
package-basic-data/pages/staff/detail/detail.js

@@ -20,13 +20,12 @@ Page({
     cardList: ['main'],
     contentObj: {
       main: [
-        { code: 'staffCode', type: 'str', readonly: true, title: mixins.$t('staffCode') },
+       
         { code: 'staffName', type: 'str', required: true, title: mixins.$t('staffName') },
         { code: 'staffPhone', type: 'phone', title: mixins.$t('staffPhone'), required: true },
         { code: 'orgId', name: 'orgName', type: 'drop', required: true, dropType: 'org' },
         { code: 'roleId', name: 'roleName', type: 'mutidrop', required: false, dropType: 'role' },
-        { code: 'flgCanLogin', type: 'checkbox', title: mixins.$t('flgCanLogin') },
-        { code: 'remarks', type: 'textarea', title: mixins.$t('remarks') }
+      
       ]
     },
     // 路由
@@ -61,22 +60,10 @@ Page({
   * @author : 姜永辉
   */
   saveData() {
-    if (this.data.formMode == Constants.formMode.edit) {
-      return this.excute(this.data.service, this.data.service.update, this.data.params)
-    } else {
-      return this.excute(this.data.service, this.data.service.insert, this.data.params)
-    }
-
+    return this.excute(this.data.service, this.data.service.insertRequestStaff, this.data.params)
   },
 
-  /**
-   * @desc :   处理接口返回数据
-   * @date : 2024/2/1 15:49
-   * @author : 于继渤
-   */
-  handleSearchData(tableData) {
-    console.log("handleSearchData", tableData);
-  },
+ 
   /**
    * @desc : 给表单赋值
    * @date : 2024/2/1 15:49
@@ -84,6 +71,10 @@ Page({
    */
   setValuesByEdit(data) {
     console.log("setValuesByEdit", data);
+    data.staffPhone = data.userPhone
+    data.staffName = data.userPhone
+    data.flgCanLogin = true
+    data.wxUserId = data.userId
     this.setData({
       formData: JSON.stringify(data)
     })

+ 1 - 1
package-basic-data/pages/staff/detail/detail.wxml

@@ -7,6 +7,6 @@
 </dk-form>
 <!--  保存 -->
 <view class="bottom-class">
-  <van-button custom-class="save-button-class" disabled="{{loading}}" loading="{{loading}}" bind:click="save" type="default">保存
+  <van-button custom-class="save-button-class" disabled="{{loading}}" loading="{{loading}}" bind:click="save" type="default">{{$t['confirm']}}
   </van-button>
 </view>

+ 16 - 16
pages/home-page/home-page.js

@@ -11,7 +11,7 @@
 const app = getApp()
 const api = require('@/utils/api.js');
 const config = require('@/config/config.js');
-const Constants = require('@/utils/Constants.js'); 
+const Constants = require('@/utils/Constants.js');
 const util = require('@/utils/util.js')
 const mixins = require('@/mixins/index.js')
 
@@ -205,24 +205,24 @@ Page({
       }
     })
 
-    console.log("homepage",options); 
+    console.log("homepage", options);
     // options 中的 scene  
     if (options.scene) {
-        var scene = options.scene
-        
-        // 邀请员工的确认
-        wx.navigateTo({
-          url: '/package-basic-data/pages/staff/detail/detail',
-          events: {
-            // 回调后,在这里给页面赋值
-            bandData: function (e) {
-            }
-          },
-          success: function (res) {
-            // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
-            res.eventChannel.emit('params', {  formType: scene})
+      var scene = options.scene
+
+      // 邀请员工的确认
+      wx.navigateTo({
+        url: '/package-basic-data/pages/staff/detail/detail',
+        events: {
+          // 回调后,在这里给页面赋值
+          bandData: function (e) {
           }
-        })
+        },
+        success: function (res) {
+          // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
+          res.eventChannel.emit('params', { other: scene, formMode: Constants.formMode.other })
+        }
+      })
 
     }
 

+ 2 - 2
pages/welcome/welcome.js

@@ -123,8 +123,8 @@ Page({
             app.globalData.user = res.data.data
             app.globalData.token = res.data.data.accessToken
             wx.reLaunch({
-                url: '../../pages/home-page/home-page'  ,
-                // url: '../../pages/home-page/home-page?scene=' + 'oNIC56zcqYkZrgovQK2_90u2g90o',
+                // url: '../../pages/home-page/home-page'  ,
+                url: '../../pages/home-page/home-page' ,
             })
 
             // if (res.data.code === Constants.SUCESS_CODE) {

+ 3 - 1
utils/Constants.js

@@ -83,7 +83,9 @@ module.exports = {
     // 编辑
     edit:'edit',
     // 明细
-    detail:'detail'
+    detail:'detail',
+    // 其他
+    other:'other'
   },
 
   // 查询条件日期数据源