index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <script>
  2. import { MODEIFYBUYER } from "@/api/business/purchase/task";
  3. export default {
  4. name: "ModifyBuyerDialog",
  5. components: {
  6. ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
  7. },
  8. data() {
  9. return {
  10. size: "mini",
  11. title: "转 派",
  12. visible: false,
  13. loading: false,
  14. params: { id: "", buyer: "", buyerName: "" },
  15. };
  16. },
  17. computed: {},
  18. watch: {},
  19. methods: {
  20. //
  21. open(prop) {
  22. this.visible = true;
  23. this.params.id = prop;
  24. },
  25. //
  26. hide() {
  27. this.visible = false;
  28. this.params.id = "";
  29. this.params.buyer = "";
  30. this.params.buyerName = "";
  31. },
  32. //
  33. async submit(prop) {
  34. try {
  35. // try
  36. this.loading = true;
  37. const { id, buyer, buyerName } = prop;
  38. const { msg, code } = await MODEIFYBUYER([
  39. {
  40. id,
  41. buyer,
  42. buyerName,
  43. },
  44. ]);
  45. if (code === 200) {
  46. this.hide();
  47. this.$emit("success");
  48. this.$notify.success({ title: msg });
  49. }
  50. } catch (err) {
  51. // catch
  52. } finally {
  53. // loading
  54. this.loading = false;
  55. }
  56. },
  57. },
  58. created() {},
  59. mounted() {},
  60. destroyed() {},
  61. };
  62. </script>
  63. <template>
  64. <el-dialog
  65. width="25%"
  66. :show-close="false"
  67. :visible.sync="visible"
  68. @close="hide"
  69. >
  70. <div
  71. slot="title"
  72. style="display: flex; justify-content: space-between; align-items: center"
  73. >
  74. <span>{{ title }}</span>
  75. <span>
  76. <el-button
  77. :size="size"
  78. :disabled="loading"
  79. circle
  80. icon="el-icon-check"
  81. @click="submit(params)"
  82. >
  83. </el-button>
  84. <el-button
  85. :size="size"
  86. :disabled="loading"
  87. circle
  88. type="danger"
  89. icon="el-icon-close"
  90. @click="visible = false"
  91. >
  92. </el-button>
  93. </span>
  94. </div>
  95. <el-alert
  96. title="转派后,采购任务将会从您的采购任务清单中删除,转移到转派目标人员的已受理采购任务清单中,您确定要转派吗?"
  97. type="info"
  98. show-icon
  99. :closable="false"
  100. style="margin-bottom: 10px"
  101. >
  102. </el-alert>
  103. <el-form
  104. :size="size"
  105. :model="params"
  106. label-width="0px"
  107. label-position="right"
  108. style="padding: 0"
  109. >
  110. <el-form-item prop="" label="">
  111. <el-popover-select-v2
  112. v-model="params.buyerName"
  113. :source.sync="params"
  114. :data-mapping="{ buyer: 'code', buyerName: 'name' }"
  115. valueKey="name"
  116. referName="CONTACTS_PARAM"
  117. >
  118. </el-popover-select-v2>
  119. </el-form-item>
  120. </el-form>
  121. </el-dialog>
  122. </template>
  123. <style scoped></style>