editInterstcla.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <div class="edit_interest_cla_box">
  3. <!-- 编辑兴趣班弹框 -->
  4. <el-dialog :visible.sync="InterestClaEditvisible" width="442px">
  5. <template slot="title">
  6. <div class="dia_title_box">
  7. <span>{{ lang.ssInterestClass }}</span>
  8. </div>
  9. </template>
  10. <div class="dia_box_item" v-loading="isLoading">
  11. <div class="addcla_box_item">
  12. <span class="addcla_box_item_span">{{ lang.ssInterClaNameColon }}</span>
  13. <el-input
  14. v-model.trim="clainfo.name"
  15. :placeholder="lang.ssEnterInterClaNm"
  16. ></el-input>
  17. </div>
  18. </div>
  19. <div slot="footer" class="dialog-footer">
  20. <el-button @click="cancelAllSelection">{{ lang.Cancel }}</el-button>
  21. <el-button type="primary" @click="confirmInterestClaEdit"
  22. >{{ lang.Confirm }}</el-button
  23. >
  24. </div>
  25. </el-dialog>
  26. </div>
  27. </template>
  28. <script>
  29. import { myMixin } from "@/mixins/mixin.js"
  30. export default {
  31. mixins: [ myMixin ],
  32. name: "editInterstcla",
  33. props: {
  34. interestClaEditInfo: {
  35. type: Object,
  36. default: () => {},
  37. }
  38. },
  39. watch: {
  40. interestClaEditInfo: {
  41. handler(newVal) {
  42. this.clainfo = newVal;
  43. },
  44. immediate: true,
  45. },
  46. },
  47. data() {
  48. return {
  49. userid: this.$route.query.userid,
  50. org: this.$route.query.org,
  51. oid: this.$route.query.oid,
  52. role: this.$route.query.role,
  53. clainfo: {}, // 班级信息
  54. InterestClaEditvisible: false, // 兴趣班编辑信息
  55. isLoading: false, // 是否加载中
  56. };
  57. },
  58. methods: {
  59. // 取消编辑兴趣班
  60. cancelAllSelection() {
  61. this.InterestClaEditvisible = false;
  62. },
  63. // 编辑兴趣班确定
  64. confirmInterestClaEdit() {
  65. if (this.clainfo.name == "") {
  66. this.$message({
  67. message: this.lang.ssEnterInterClaNm,
  68. type: "error",
  69. });
  70. return;
  71. }
  72. if (this.isLoading) {
  73. this.$message.warning(this.lang.ssEditing);
  74. return;
  75. }
  76. this.isLoading = true;
  77. this.confirmClaEdit();
  78. },
  79. // 修改班级名称确定
  80. confirmClaEdit() {
  81. let params = {
  82. id: this.clainfo.id,
  83. n: this.clainfo.name,
  84. pid: this.clainfo.pid,
  85. oid: this.oid,
  86. };
  87. this.ajax
  88. .get(this.$store.state.api + "updateClassNew", params)
  89. .then((res) => {
  90. this.isLoading = false;
  91. if (res.data[0] && res.data[0][0].classname == 1) {
  92. this.$message({
  93. message: this.lang.Cannotsameothercla,
  94. type: "error",
  95. });
  96. this.addOp3('1', "", { type: "interest_class_edit" }, err)
  97. } else {
  98. this.$message({
  99. message: this.lang.Editsuccessful,
  100. type: "success",
  101. });
  102. // this.$emit("getInterestClass");
  103. this.$emit("getCascaderData");
  104. this.InterestClaEditvisible = false;
  105. this.addOp3('1', "", { type: "interest_class_edit" }, "success")
  106. }
  107. })
  108. .catch((err) => {
  109. this.isLoading = false;
  110. this.$message({
  111. message: this.lang.Modificationfailed,
  112. type: "error",
  113. });
  114. this.InterestClaEditvisible = false;
  115. console.error(err);
  116. this.addOp3('1', "", { type: "interest_class_edit" }, err)
  117. });
  118. },
  119. },
  120. };
  121. </script>
  122. <style scoped>
  123. .dia_box_item {
  124. display: flex;
  125. flex-direction: column;
  126. gap: 10px;
  127. }
  128. .addcla_box_item {
  129. min-height: 35px;
  130. /* line-height: 30px; */
  131. display: flex;
  132. align-items: center;
  133. gap: 10px;
  134. }
  135. .addcla_box_item >>> .el-cascader {
  136. width: 100%;
  137. }
  138. .addcla_box_item >>> .el-select {
  139. width: 100%;
  140. }
  141. .addcla_box_item >>> .el-input__inner {
  142. width: 100%;
  143. }
  144. .addcla_box_item >>> .el-input__icon {
  145. width: 100%;
  146. }
  147. .addcla_box_item > .addcla_box_item_span {
  148. width: 80px;
  149. flex-shrink: 0;
  150. text-align: right;
  151. }
  152. .tableList >>> .el-table__body-wrapper {
  153. height: 500px;
  154. }
  155. .cla_span {
  156. background: #e8f3ff;
  157. color: #0052d9;
  158. padding: 0px 10px;
  159. border-radius: 5px;
  160. box-sizing: border-box;
  161. }
  162. .search_stu_box {
  163. width: 670px;
  164. position: absolute;
  165. display: flex;
  166. flex-direction: column;
  167. top: 100%;
  168. left: 90px;
  169. z-index: 1000;
  170. min-height: 160px;
  171. background: #fff;
  172. border: 1px solid #e8f3ff;
  173. box-sizing: border-box;
  174. padding: 10px;
  175. }
  176. .search_stu_box_content {
  177. display: flex;
  178. gap: 10px;
  179. flex-wrap: wrap;
  180. flex: 1;
  181. }
  182. .selected_stu_box_item {
  183. background: #e8f3ff;
  184. padding: 0px 10px;
  185. height: 30px;
  186. line-height: 30px;
  187. border-radius: 5px;
  188. box-sizing: border-box;
  189. }
  190. .search_stu_box_footer {
  191. display: flex;
  192. height: 40px;
  193. justify-content: space-between;
  194. align-items: center;
  195. box-sizing: border-box;
  196. }
  197. .selected_stu_box {
  198. display: flex;
  199. flex-wrap: wrap;
  200. gap: 10px;
  201. }
  202. .page_box {
  203. display: flex;
  204. gap: 10px;
  205. align-items: center;
  206. }
  207. .cla_box {
  208. display: flex;
  209. align-items: center;
  210. gap: 5px;
  211. }
  212. </style>