matchingDlg.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <script setup>
  2. import { ref, watch, nextTick } from "vue";
  3. import { raiInterface } from "@/api/api.js";
  4. import { ElMessage } from "element-plus";
  5. const props = defineProps({
  6. matchingDlgShow: {
  7. type: Boolean,
  8. default: false,
  9. },
  10. matchingId: {
  11. type: Number,
  12. },
  13. });
  14. const dataQueryList = ref([]);
  15. const matchingValue = ref("");
  16. const $emit = defineEmits(["getsDataList"]);
  17. function closeDlg() {
  18. matchingValue.value = "";
  19. dataQueryList.value = [];
  20. $emit("update:matchingDlgShow", false);
  21. }
  22. //作者的搜索
  23. async function remoteMethod(query) {
  24. if (query !== "") {
  25. dataQueryList.value = [];
  26. const res = await raiInterface.activityMeetMatchingList({ KeyWord: query });
  27. if (res.Ret === 200) {
  28. let obj = {};
  29. res.Data.List &&
  30. res.Data.List.forEach((item) => {
  31. obj = {
  32. ...item,
  33. value: item.RoadshowTitle + `【` + item.ActivityTime + "】",
  34. };
  35. dataQueryList.value.push(obj);
  36. });
  37. }
  38. } else {
  39. dataQueryList.value = [];
  40. }
  41. }
  42. async function confirm() {
  43. if (!matchingValue) return ElMessage.error("请输入活动名称关键字");
  44. const res = await raiInterface.activityMeetMatchingByHand({
  45. ActivityId: props.matchingId,
  46. KeyWord: matchingValue.value,
  47. });
  48. if (res.Ret === 200) {
  49. dataQueryList.value = [];
  50. matchingValuev.value = "";
  51. ElMessage.success("操作成功!");
  52. $emit("update:matchingDlgShow", false);
  53. $emit("getsDataList");
  54. }
  55. }
  56. </script>
  57. <template>
  58. <div class="container-macthing">
  59. <el-dialog draggable :modal-append-to-body="false" center v-model="props.matchingDlgShow" @beforeClose="closeDlg" :width="'40%'">
  60. <div class="content-macthing">
  61. <el-select style="width: 100%" v-model="matchingValue" filterable clearable :filter-method="remoteMethod" placeholder="请输入活动名称关键字">
  62. <el-option v-for="item in dataQueryList" :key="item.RoadshowTitle + item.ActivityTime" :label="item.value" :value="item.RoadshowTitle + '{|}' + item.ActivityTime"> </el-option>
  63. </el-select>
  64. </div>
  65. <template #header>
  66. <div style="display: flex; align-items: center">
  67. <img :src="$icons.warntop" style="color: #fff; width: 16px; height: 16px; margin-right: 5px" />
  68. <span style="fontsize: 16px">手动匹配</span>
  69. </div>
  70. </template>
  71. <template #footer>
  72. <div style="margin-top: 40px">
  73. <el-button type="primary" @click="confirm">确定</el-button>
  74. <el-button type="primary" @click="closeDlg">取消</el-button>
  75. </div>
  76. </template>
  77. </el-dialog>
  78. </div>
  79. </template>
  80. <style scoped lang="scss">
  81. .content-macthing {
  82. margin: 30px;
  83. }
  84. </style>