Sfoglia il codice sorgente

fix(客户管理):分配组件回滚

wanglj 3 anni fa
parent
commit
9ebf8d3714
1 ha cambiato i file con 20 aggiunte e 4 eliminazioni
  1. 20 4
      src/views/customer/components/Allocate.vue

+ 20 - 4
src/views/customer/components/Allocate.vue

@@ -2,7 +2,7 @@
  * @Author: wanglj 471442253@qq.com
  * @Date: 2022-12-26 14:34:34
  * @LastEditors: wanglj
- * @LastEditTime: 2023-01-05 09:15:25
+ * @LastEditTime: 2023-01-05 18:17:04
  * @Description: file content
  * @FilePath: \opms_frontend\src\views\customer\components\allocate.vue
 -->
@@ -16,7 +16,7 @@
       </el-form-item>
     </el-form>
     <span slot="footer">
-      <el-button size="mini" type="primary">保存</el-button>
+      <el-button size="mini" type="primary" @click="handleSubmit">保存</el-button>
       <el-button size="mini" @click="visible = false">取消</el-button>
     </span>
     <!--    <Transfer ref="transfer" />-->
@@ -27,7 +27,8 @@
 <script>
   // import Transfer from './Transfer.vue'
   import SelectUser from '@/components/select/SelectUser'
-
+  import api from '@/api/customer'
+  import to from 'await-to-js'
   export default {
     components: {
       // Transfer,
@@ -56,6 +57,8 @@
         allocate: [],
         data: generateData(),
         options: [],
+        ids: [],
+        userList: [],
       }
     },
     methods: {
@@ -65,7 +68,20 @@
         this.$refs.selectUser.open()
       },
       selectUser(userList) {
-        console.log(userList)
+        this.userList = userList
+        this.form.allocate = userList.map((item) => item.userName).join()
+      },
+      async handleSubmit() {
+        let params = {
+          salesId: this.userList[0].id,
+          ids: this.ids,
+          salesName: this.userList[0].userName,
+        }
+        const [err, res] = await to(api.receiveCustomer(params))
+        if (err) return
+        this.$message.success(res.msg)
+        this.visible = false
+        this.$emit('refresh')
       },
     },
   }