index.vue 2.9 KB

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