editCustomerSource.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div>
  3. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  4. <el-form-item label="客户数量" >
  5. {{ids.length}}个
  6. </el-form-item>
  7. <el-form-item label="客户来源" prop="source">
  8. <el-select v-model="form.source" placeholder="请选择客户来源" clearable size="small">
  9. <el-option
  10. v-for="item in sourceOptions"
  11. :key="item.dictValue"
  12. :label="item.dictLabel"
  13. :value="item.dictValue"
  14. />
  15. </el-select>
  16. </el-form-item>
  17. </el-form>
  18. <div class="dialog-footer">
  19. <el-button type="primary" @click="submitForm">确 定</el-button>
  20. <el-button @click="cancel">取 消</el-button>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. import { listCustomer,getCustomer,addCustomer,updateCustomerSource,delCustomer,exportCustomer } from "@/api/crm/customer";
  26. export default {
  27. name: "customerVisit",
  28. data() {
  29. return {
  30. sourceOptions:[],
  31. ids:[],
  32. // 表单参数
  33. form: {},
  34. // 表单校验
  35. rules: {
  36. source: [
  37. { required: true, message: "客户来源不能为空", trigger: "blur" }
  38. ],
  39. }
  40. };
  41. },
  42. created() {
  43. this.getDicts("sys_crm_customer_source").then((response) => {
  44. this.sourceOptions = response.data;
  45. });
  46. },
  47. methods: {
  48. cancel(){
  49. this.$emit('close');
  50. },
  51. handleEdit(ids) {
  52. console.log(ids)
  53. this.ids=ids;
  54. },
  55. /** 提交按钮 */
  56. submitForm() {
  57. this.$refs["form"].validate(valid => {
  58. if (valid) {
  59. this.form.ids=this.ids.toString();
  60. updateCustomerSource(this.form).then(response => {
  61. if (response.code === 200) {
  62. this.msgSuccess("修改成功");
  63. this.$emit('close');
  64. }
  65. });
  66. }
  67. });
  68. },
  69. }
  70. };
  71. </script>
  72. <style lang="scss" scoped>
  73. .dialog-footer{
  74. margin-bottom: 10px;
  75. text-align: right;
  76. }
  77. </style>