set.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <div class="meeting-set">
  3. <div class="meeting-item hui-flex hui-content">
  4. <div class="hui-content-title">
  5. <div class="hui-title-item active">会议场所</div>
  6. </div>
  7. <div class="hui-flex-box">
  8. <div class="tag">
  9. <div class="target-item" v-for="item in placeList" :key="item.id">
  10. <span class="label">{{item.name}}</span>
  11. <i class="iconfont huifont-bianji" @click.stop="updateFunc(1,item)"></i>
  12. <i class="iconfont huifont-guanbi" @click.stop="deleteFunc(1,item)"></i>
  13. </div>
  14. <div class="target-item target-item-insert" @click="insertFunc(1)">
  15. <i class="iconfont huifont-xinzeng"></i>
  16. <span class="label">新增场所</span>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="meeting-line"></div>
  22. <div class="meeting-item hui-flex hui-content">
  23. <div class="hui-content-title">
  24. <div class="hui-title-item active">会议类型</div>
  25. </div>
  26. <div class="hui-flex-box">
  27. <div class="tag">
  28. <div class="target-item" v-for="item in typeList" :key="item.id">
  29. <span class="label">{{item.name}}</span>
  30. <i class="iconfont huifont-bianji" @click.stop="updateFunc(2,item)"></i>
  31. <i class="iconfont huifont-guanbi" @click.stop="deleteFunc(2,item)"></i>
  32. </div>
  33. <div class="target-item target-item-insert" @click="insertFunc(2)">
  34. <i class="iconfont huifont-xinzeng"></i>
  35. <span class="label">新增类型</span>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. export default {
  44. data() {
  45. return {
  46. placeList: [],
  47. typeList: [],
  48. index: 1
  49. }
  50. },
  51. methods: {
  52. insertFunc(type) {
  53. let msg = type === 1 ? '场所名称' : '类型名称';
  54. this.$prompt(`请输入${msg}`, '有极', {
  55. confirmButtonText: '确 定',
  56. cancelButtonClass: 'cancel',
  57. confirmButtonClass: 'confirm',
  58. cancelButtonText: '取 消',
  59. inputPattern: /\S/,
  60. inputErrorMessage: `请输入${msg}`
  61. }).then(({
  62. value
  63. }) => {
  64. let item = {
  65. id: this.index,
  66. name: value
  67. }
  68. if (type === 1) {
  69. this.placeList.push(item);
  70. } else {
  71. this.typeList.push(item);
  72. }
  73. this.index++;
  74. this.$message.success('操作成功');
  75. }).catch(() => {});
  76. },
  77. updateFunc(type, item) {
  78. let msg = type === 1 ? '场所名称' : '类型名称';
  79. this.$prompt(`请输入${msg}`, '有极', {
  80. confirmButtonText: '确 定',
  81. cancelButtonClass: 'cancel',
  82. confirmButtonClass: 'confirm',
  83. cancelButtonText: '取 消',
  84. inputPattern: /\S/,
  85. inputErrorMessage: `请输入${msg}`,
  86. inputValue: item.name
  87. }).then(({
  88. value
  89. }) => {
  90. item.name = value;
  91. this.$message.success('操作成功');
  92. }).catch(() => {});
  93. },
  94. deleteFunc(type, item) {
  95. let msg = type === 1 ? '场所名称' : '类型名称';
  96. this.$confirm(`确定要删除该${msg}?`, () => {
  97. if (type === 1) {
  98. let index = this.placeList.findIndex(node => node.id === item.id);
  99. this.placeList.splice(index, 1);
  100. } else {
  101. let index = this.typeList.findIndex(node => node.id === item.id);
  102. this.typeList.splice(index, 1);
  103. }
  104. this.$message.success('操作成功');
  105. });
  106. }
  107. },
  108. }
  109. </script>
  110. <style lang="scss">
  111. .meeting-set {
  112. width: 100%;
  113. height: 100%;
  114. display: flex;
  115. .meeting-item {
  116. flex: 1;
  117. height: 100%;
  118. }
  119. .hui-flex-box {
  120. padding: 10px;
  121. }
  122. .meeting-line {
  123. width: 15px;
  124. height: 100%;
  125. background: $--background;
  126. }
  127. .tag {
  128. display: flex;
  129. flex-wrap: wrap;
  130. .target-item {
  131. display: flex;
  132. height: 28px;
  133. align-items: center;
  134. margin: 5px 0;
  135. margin-right: 15px;
  136. background: #46577a;
  137. border-radius: 15px;
  138. padding: 0 15px;
  139. .label {
  140. font-size: 12px;
  141. }
  142. .iconfont {
  143. margin-left: 10px;
  144. font-size: 12px;
  145. cursor: pointer;
  146. }
  147. .huifont-bianji {
  148. font-size: 18px;
  149. }
  150. }
  151. .target-item-insert {
  152. cursor: pointer;
  153. background: transparent;
  154. border: 1px solid #7383ad;
  155. .iconfont {
  156. margin-left: 0;
  157. margin-right: 10px;
  158. }
  159. }
  160. .target-item-insert:hover {
  161. border-color: $--color-primary;
  162. color: $--color-primary;
  163. }
  164. }
  165. }
  166. </style>