editMobile.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <script setup>
  2. import { ref, watch } from "vue";
  3. import { raiInterface, raiSpecial } from "@/api/api.js";
  4. import { ElMessage } from "element-plus";
  5. const props = defineProps({
  6. editMobileDialogVisible: {
  7. type: Boolean,
  8. default: false,
  9. required: true,
  10. },
  11. editMobileId: {
  12. type: Number,
  13. required: true,
  14. },
  15. outboundMobile: {
  16. type: String,
  17. required: true,
  18. },
  19. isType: {
  20. type: String,
  21. default: "",
  22. },
  23. });
  24. const selectValue = ref("86");
  25. const optionsMobile = ref([
  26. { value: "+86", key: "86" },
  27. { value: "+852", key: "852" },
  28. { value: "+886", key: "886" },
  29. { value: "+1", key: "1" },
  30. { value: "+65", key: "65" },
  31. ]);
  32. const modelKey = ref("");
  33. watch(
  34. () => props.editMobileDialogVisible,
  35. (newval) => {
  36. if (newval) {
  37. activitySignupSignupDetail();
  38. }
  39. }
  40. );
  41. async function activitySignupSignupDetail() {
  42. const res = props.isType ? await "" : await raiInterface.activitySignupSignupDetail({ Id: props.editMobileId });
  43. if (res.Ret === 200) {
  44. selectValue.value = res.Data.CountryCode ? res.Data.CountryCode : "86";
  45. modelKey.value = res.Data.OutboundMobile;
  46. }
  47. }
  48. const $emit = defineEmits(["getsDataList"]);
  49. function handleClose() {
  50. selectValue.value = "86";
  51. modelKey.value = "";
  52. $emit("update:editMobileDialogVisible", false);
  53. $emit("update:outboundMobile", "");
  54. }
  55. async function btnOk() {
  56. const res = props.isType
  57. ? await raiSpecial.outboundMobileEdit({
  58. CountryCode: selectValue.value,
  59. OutboundMobile: modelKey.value,
  60. Id: props.editMobileId,
  61. })
  62. : await raiInterface.outboundMobileEdit({
  63. CountryCode: selectValue.value,
  64. OutboundMobile: modelKey.value,
  65. Id: props.editMobileId,
  66. });
  67. if (res.Ret !== 200) return;
  68. ElMessage.success("操作成功");
  69. selectValue.value = "86";
  70. modelKey.value = "";
  71. $emit("update:editMobileDialogVisible", false);
  72. $emit("update:outboundMobile", "");
  73. $emit("getsDataList");
  74. }
  75. </script>
  76. <template>
  77. <div class="container-editMobile">
  78. <el-dialog draggable :close-on-click-modal="false" :modal-append-to-body="false" center :append-to-body="true" width="40%" v-model="props.editMobileDialogVisible" :before-close="handleClose">
  79. <template #header>
  80. <div style="display: flex; align-items: center">
  81. <img :src="$icons.edit_garden" style="color: #fff; width: 16px; height: 16px; margin-right: 5px" />
  82. <span style="font-size: 16px">修改外呼号码</span>
  83. </div>
  84. </template>
  85. <div class="content-box" style="margin-top: 20px; margin-bottom: 60px">
  86. <el-select style="width: 90px" v-model="selectValue" placeholder="请选择">
  87. <el-option v-for="item in optionsMobile" :key="item.key" :label="item.value" :value="item.key"> </el-option>
  88. </el-select>
  89. <el-input style="width: 368px" v-model="modelKey" placeholder="请输入手机号或座机号" />
  90. <p style="margin-top: 15px">座机号请填写区号,分机号用"-"分隔,例:02150509999-8888</p>
  91. </div>
  92. <template #footer>
  93. <span class="dialog-footer">
  94. <el-button @click="handleClose">取 消</el-button>
  95. <el-button type="primary" @click="btnOk">确 定</el-button>
  96. </span>
  97. </template>
  98. </el-dialog>
  99. </div>
  100. </template>
  101. <style lang="scss">
  102. .el-select {
  103. .el-input,
  104. .el-input__wrapper {
  105. width: 100% !important;
  106. }
  107. }
  108. </style>
  109. <style scoped lang="scss">
  110. .container-editMobile {
  111. .content-box {
  112. margin-top: 20px;
  113. margin-bottom: 60px;
  114. display: flex;
  115. }
  116. }
  117. </style>