addChatForm.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div>
  3. <el-dialog
  4. width="500px"
  5. title="新建群聊"
  6. :visible.sync="lookVisible"
  7. :before-close="onClose"
  8. >
  9. <el-form :model="formes" label-width="120px" ref="eidtPostMsg">
  10. <el-form-item
  11. label="群聊名称"
  12. :rules="[{ required: true, message: '请输入群聊名称' }]"
  13. prop="groupName"
  14. >
  15. <el-input class="w100" v-model="formes.groupName"></el-input>
  16. </el-form-item>
  17. <el-form-item
  18. label="群聊类型"
  19. :rules="[{ required: true, message: '请选择群聊类型' }]"
  20. prop="groupType"
  21. >
  22. <el-select
  23. class="w100"
  24. v-model.trim="formes.groupType"
  25. clearable
  26. filterable
  27. placeholder="群聊类型"
  28. >
  29. <el-option
  30. v-for="(item, index) in catgGoupTypeList"
  31. :key="index"
  32. :value="item.value"
  33. :label="item.label"
  34. ></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item
  38. label="群类型"
  39. :rules="[{ required: true, message: '请选择群类型' }]"
  40. prop="groupType"
  41. >
  42. <el-select
  43. class="w100"
  44. v-model.trim="formes.type"
  45. clearable
  46. filterable
  47. placeholder="群聊类型"
  48. >
  49. <el-option
  50. v-for="(item, index) in catTypeList"
  51. :key="index"
  52. :value="item.value"
  53. :label="item.label"
  54. ></el-option>
  55. </el-select>
  56. </el-form-item>
  57. </el-form>
  58. <div slot="footer" class="dialog-footer">
  59. <el-button @click="onClose">取 消</el-button>
  60. <el-button type="primary" @click="submitMsg">确 定</el-button>
  61. </div>
  62. </el-dialog>
  63. </div>
  64. </template>
  65. <script>
  66. import { createGroup } from "../api";
  67. import { catgGoupTypeList,catTypeList } from "@/utils/searchArray";
  68. export default {
  69. name: "eidtPostMsg",
  70. data() {
  71. return {
  72. formes: {
  73. id: "",
  74. groupName: "",
  75. groupType: "",
  76. type:""
  77. },
  78. catgGoupTypeList,
  79. catTypeList,
  80. lookVisible: false,
  81. chioseIdList: null,
  82. activeRow: null,
  83. type: "",
  84. title: "",
  85. };
  86. },
  87. mounted() {
  88. this.init();
  89. },
  90. methods: {
  91. init() {},
  92. openDioag() {
  93. this.lookVisible = true;
  94. },
  95. openResetDioag(row, type) {
  96. this.type = type;
  97. if (type == "name") {
  98. this.title = "修改群聊名称";
  99. } else {
  100. this.title = "修改群聊类型";
  101. }
  102. // this.activeRow = row;
  103. this.formes = { ...row };
  104. this.lookVisible = true;
  105. },
  106. onClose() {
  107. this.formes = {
  108. name: "",
  109. groupType: "",
  110. };
  111. this.$refs["eidtPostMsg"].resetFields();
  112. this.lookVisible = false;
  113. },
  114. submitMsg() {
  115. this.$refs.eidtPostMsg.validate(async (flag) => {
  116. if (flag) {
  117. try {
  118. const res = await createGroup({ ...this.formes });
  119. this.$message.success("新增成功");
  120. this.$emit("getList");
  121. this.onClose();
  122. } catch (e) {
  123. console.log(e);
  124. }
  125. }
  126. });
  127. },
  128. getName(val) {
  129. this.formes.fileName = val.data.name;
  130. },
  131. payDate() {
  132. let self = this;
  133. return {
  134. firstDayOfWeek: 1,
  135. disabledDate(time) {
  136. return time.getTime() + 86400000 < new Date().getTime();
  137. },
  138. };
  139. },
  140. },
  141. };
  142. </script>
  143. <style lang="scss" scoped>
  144. .w100 {
  145. width: 100% !important;
  146. }
  147. </style>