Browse Source

feat: 企微助手 - 成员管理 - 信息绑定(adq回传)

zhengxy 2 years ago
parent
commit
f93141ca08

+ 1 - 0
project/src/assets/config/interface_api.js

@@ -22,6 +22,7 @@ var api = {
22 22
   logout: "/api/loginOut",
23 23
   userList: "/api/user/userList",
24 24
   memberList: "/api/user/users",
25
+  bindUserActionSetId: "/api/user/bindUserActionSetId",
25 26
   addWayList: "/api/customer/addWayList",
26 27
   tagList: "/api/tag/tagList",
27 28
   addTag: "/api/tag/addTag",

+ 56 - 27
project/src/components/manage/dialog/memberInfoBind.vue

@@ -9,14 +9,16 @@
9 9
     <div class="form-wrap" v-loading="loading">
10 10
       <div class="form-item">
11 11
         <span class="lable required">所属类型</span>
12
-        <el-select v-model="form.type" size="small" placeholder="请选择成员所属类型">
12
+        <span>ADQ</span><!-- 写死为ADQ -->
13
+        <!-- <el-select v-model="form.type" size="small" placeholder="请选择成员所属类型">
13 14
           <el-option v-for="t in typeOptions" :key="t.value" :label="t.label" :value="t.value" />
14
-        </el-select>
15
+        </el-select> -->
15 16
       </div>
16 17
       <div class="form-item">
17
-        <span class="lable required">数据源ID</span>
18
-        <el-input v-model="form.sourceId" size="small" placeholder="请输入数据源ID" />
18
+        <span class="lable">数据源ID</span>
19
+        <el-input v-model="form.user_action_set_id" size="small" placeholder="请输入数据源ID" clearable />
19 20
       </div>
21
+      <div class="form-tips">可传空,此时会将原来设置的数据源置空</div>
20 22
     </div>
21 23
     <div slot="footer" class="dialog-footer">
22 24
       <el-button size="mini" @click="handleCancel">取 消</el-button>
@@ -39,21 +41,29 @@ export default {
39 41
       type: Boolean,
40 42
       default: () => false
41 43
     },
44
+    // 成员信息
45
+    userInfo: {
46
+      type: Object,
47
+      default: () => ({
48
+        user_action_set_id: '',
49
+        user_id: '',
50
+      })
51
+    },
42 52
   },
43 53
   data() {
44 54
     return {
45 55
       loading: false,
46 56
       typeOptions: Object.freeze(typeOptions),
47 57
       form: {
48
-        type: '',
49
-        sourceId: '',
58
+        user_action_set_id: '',
59
+        user_id: '',
50 60
       }
51 61
     }
52 62
   },
53 63
   watch: {
54
-    // 弹框展示时初始化数据
64
+    // 弹框展示时获取表单数据
55 65
     dialogVisible(isShow) {
56
-      isShow && this.handleInit()
66
+      isShow && this.handleGetFormData()
57 67
     },
58 68
   },
59 69
   methods: {
@@ -61,11 +71,12 @@ export default {
61 71
       try {
62 72
         // 表单校验
63 73
         await this.handleFormValidate()
64
-        this.loading = true
65 74
         const params = { ...this.form }
66
-        const { data: res } = await this.$axios.post(`${this.URL.BASEURL}${this.URL.xxx}`, params)
75
+        this.loading = true
76
+        const { data: res = {} } = await this.$axios.post(`${this.URL.BASEURL}${this.URL.bindUserActionSetId}`, params)
67 77
         if (res && res.errno == 0) {
68 78
           this.$message.success('操作成功')
79
+          this.handleClearFormData()
69 80
           this.$emit('confirm')
70 81
         } else if (res.errno != 4002) {
71 82
           this.$message.warning(res.err || '操作失败')
@@ -77,26 +88,33 @@ export default {
77 88
       }
78 89
     },
79 90
     handleCancel() {
91
+      this.handleClearFormData()
80 92
       this.$emit('cancel')
81 93
     },
82 94
     // 执行表单校验
83 95
     handleFormValidate() {
84 96
       return new Promise((resolve, reject) => {
85
-        if (!this.form.type) {
86
-          this.$message.warning('请选择成员所属类型')
87
-          reject('表单校验未通过')
88
-        } else if (!this.form.sourceId) {
89
-          this.$message.warning('请输入数据源ID')
90
-          reject('表单校验未通过')
91
-        } else {
92
-          resolve('表单校验通过')
93
-        }
97
+        // if (!this.form.user_action_set_id) {
98
+        //   this.$message.warning('请输入数据源ID')
99
+        //   reject('表单校验未通过')
100
+        // } else {
101
+        //   resolve('表单校验通过')
102
+        // }
103
+
104
+        // 此版本无必填项
105
+        resolve('表单校验通过')
94 106
       })
95 107
     },
96
-    // 初始化弹框表单数据
97
-    handleInit() {
98
-      this.form.type = ''
99
-      this.form.sourceId = ''
108
+    // 获取弹框表单数据
109
+    handleGetFormData() {
110
+      const { user_action_set_id = '', user_id = '' } = this.userInfo
111
+      this.form.user_action_set_id = user_action_set_id
112
+      this.form.user_id = user_id
113
+    },
114
+    // 清空弹框表单数据
115
+    handleClearFormData() {
116
+      this.form.user_action_set_id = ''
117
+      this.form.user_id = ''
100 118
     },
101 119
   },
102 120
 };
@@ -105,6 +123,7 @@ export default {
105 123
 <style lang="scss" scoped>
106 124
 .bind-dialog {
107 125
   .form-wrap {
126
+    padding: 0 10px;
108 127
     .form-item {
109 128
       display: flex;
110 129
       align-items: center;
@@ -117,16 +136,26 @@ export default {
117 136
         font-weight: 500;
118 137
         flex-shrink: 0;
119 138
 
120
-        &.required::before {
121
-          content: "*";
122
-          color: #f56c6c;
123
-          margin-right: 4px;
139
+        &.required {
140
+          position: relative;
141
+          &::before {
142
+            position: absolute;
143
+            left: -8px;
144
+            top: 0;
145
+            content: "*";
146
+            color: #f56c6c;
147
+          }
124 148
         }
125 149
       }
126 150
       .el-select {
127 151
         width: 100%;
128 152
       }
129 153
     }
154
+    .form-tips {
155
+      margin: 5px 0 0 80px;
156
+      font-size: 13px;
157
+      color: #999;
158
+    }
130 159
   }
131 160
   .dialog-footer {
132 161
     text-align: center;

+ 25 - 7
project/src/components/manage/memberManage.vue

@@ -55,16 +55,20 @@
55 55
               </div>
56 56
             </template>
57 57
           </el-table-column>
58
-          <!-- TODO: 新增"所属类型"&"信息绑定" => 待联调 -->
59
-          <!-- <el-table-column label="所属类型" align="center">
58
+          <el-table-column label="所属类型" align="center">
60 59
             <template slot-scope="{row}">
61
-              <span>ADQ(mock)</span>
60
+              <span>{{ getOrderTypeDesc(row.order_type) }}</span>
62 61
             </template>
63
-          </el-table-column> -->
62
+          </el-table-column>
63
+          <el-table-column label="数据源ID" align="center">
64
+            <template slot-scope="{row}">
65
+              <span>{{ row.user_action_set_id || '-' }}</span>
66
+            </template>
67
+          </el-table-column>
64 68
           <el-table-column label="操作" align="center" min-width="80">
65 69
             <template slot-scope="scope">
66 70
               <span class="c-00B38A pointer" @click="detailEvent(scope.row)">详情</span>
67
-              <!-- <span class="c-00B38A pointer ml-6" @click="onClickInfoBind(scope.row)">信息绑定</span> -->
71
+              <span class="c-00B38A pointer ml-6" @click="onClickInfoBind(scope.row)">信息绑定</span>
68 72
             </template>
69 73
           </el-table-column>
70 74
 
@@ -125,6 +129,7 @@
125 129
     <!-- S 信息绑定 - 弹框 -->
126 130
     <member-info-bind
127 131
       :dialogVisible="infoBindDialogVisible"
132
+      :userInfo="currentBindInfo"
128 133
       @cancel="handleInfoBindCancel"
129 134
       @confirm="handleInfoBindConfirm"
130 135
     />
@@ -136,6 +141,13 @@
136 141
 import selfinput from '../assembly/screen/input.vue'
137 142
 import userDetail from './userDetail/index.vue'
138 143
 import memberInfoBind from './dialog/memberInfoBind.vue'
144
+import { orderTypeOptions } from '@/assets/js/staticTypes'
145
+
146
+const orderTypeDesc = new Map([
147
+  [String(orderTypeOptions.MP), 'MP'],
148
+  [String(orderTypeOptions.ADQ), 'ADQ'],
149
+])
150
+
139 151
 export default {
140 152
   name: 'memberManage',
141 153
   components: {
@@ -161,7 +173,9 @@ export default {
161 173
       // standbyList:[],
162 174
       // standbyVal:'',
163 175
       // visible:false,
176
+
164 177
       infoBindDialogVisible: false, // 控制“信息绑定”弹框显示
178
+      currentBindInfo: {}, // 当前需要绑定的成员信息
165 179
     }
166 180
   },
167 181
   created () {
@@ -242,12 +256,13 @@ export default {
242 256
       this.init(1, this.keyword)
243 257
     },
244 258
 
245
-    onClickInfoBind(currentMember) {
246
-      console.log('onClickInfoBind currentMember => ', currentMember)
259
+    onClickInfoBind({ user_id = '', user_action_set_id = '' }) {
260
+      this.currentBindInfo = { user_id, user_action_set_id }
247 261
       this.infoBindDialogVisible = true
248 262
     },
249 263
     // 执行信息绑定 => 取消
250 264
     handleInfoBindCancel() {
265
+      this.currentBindInfo = {}
251 266
       this.infoBindDialogVisible = false
252 267
     },
253 268
     // 执行信息绑定 => 发送
@@ -255,6 +270,9 @@ export default {
255 270
       this.infoBindDialogVisible = false
256 271
       this.init(undefined, this.keyword)
257 272
     },
273
+    getOrderTypeDesc(type) {
274
+      return orderTypeDesc.get(String(type)) || '-'
275
+    },
258 276
   }
259 277
 }
260 278
 </script>