base.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <div id="base">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-col :span="24" class="leftTop">
  6. <span>|</span>
  7. <span>基本信息</span>
  8. </el-col>
  9. <el-col :span="24" class="info">
  10. <el-form ref="form" :model="form" label-width="150px">
  11. <el-col :span="24">
  12. <el-form-item prop="name">
  13. <el-col :span="21" slot="label">
  14. 房间号
  15. </el-col>
  16. <el-col :span="24">
  17. <el-input v-model="form.room_id" placeholder="请输入房间号" disabled></el-input>
  18. </el-col>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="24">
  22. <el-form-item prop="type">
  23. <el-col :span="21" slot="label">
  24. 类型
  25. </el-col>
  26. <el-col :span="24">
  27. <el-select v-model="form.type" placeholder="请选择类型" disabled>
  28. <el-option v-for="item in typelist" :key="item.name" :label="item.name" :value="item.id"> </el-option>
  29. </el-select>
  30. </el-col>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="24">
  34. <el-form-item prop=" title">
  35. <el-col :span="21" slot="label">
  36. 标题
  37. </el-col>
  38. <el-col :span="24">
  39. <el-input v-model="form.title" placeholder="请输入标题"></el-input>
  40. </el-col>
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="12">
  44. <el-form-item prop="orgin">
  45. <el-col :span="21" slot="label">
  46. 来源
  47. </el-col>
  48. <el-col :span="24">
  49. <el-input v-model="form.orgin" placeholder="请输入来源"></el-input>
  50. </el-col>
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="12">
  54. <el-form-item prop="create_time">
  55. <el-col :span="21" slot="label">
  56. 时间
  57. </el-col>
  58. <el-col :span="24">
  59. <el-col :span="24">
  60. <el-date-picker
  61. v-model="form.create_time"
  62. placeholder="请选择"
  63. value-format="yyyy-MM-dd"
  64. format="yyyy-MM-dd"
  65. type="date"
  66. style="width: 100%;"
  67. >
  68. </el-date-picker>
  69. </el-col>
  70. </el-col>
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="24">
  74. <el-form-item prop="desc" class="langInfo">
  75. <el-col :span="21" slot="label">
  76. 简介
  77. </el-col>
  78. <el-col :span="24">
  79. <el-input v-model="form.desc" type="textarea" placeholder="请输入简介"></el-input>
  80. </el-col>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="24" class="btn">
  84. <el-button type="primary" @click="onSubmit()">提交修改</el-button>
  85. </el-col>
  86. </el-form>
  87. </el-col>
  88. </el-col>
  89. </el-row>
  90. </div>
  91. </template>
  92. <script>
  93. const _ = require('lodash');
  94. import { mapState, createNamespacedHelpers } from 'vuex';
  95. const { mapActions: channel } = createNamespacedHelpers('channel');
  96. const { mapActions: code } = createNamespacedHelpers('code');
  97. export default {
  98. name: 'sBase',
  99. props: {},
  100. components: {},
  101. data: function() {
  102. return {
  103. form: {},
  104. typelist: [],
  105. };
  106. },
  107. created() {
  108. this.searchOther();
  109. this.search();
  110. },
  111. methods: {
  112. ...code({ codeQuery: 'query' }),
  113. ...channel(['fetch', 'update']),
  114. async search() {
  115. const res = await this.fetch(this.user._id);
  116. if (this.$checkRes(res)) {
  117. this.$set(this, `form`, res.data);
  118. }
  119. },
  120. async searchOther(val) {
  121. let res = await this.codeQuery({ category: '04' });
  122. if (this.$checkRes(res)) {
  123. this.$set(this, `typelist`, res.data);
  124. }
  125. },
  126. async onSubmit() {
  127. const res = await this.update(_.cloneDeep(this.form));
  128. this.$checkRes(res, '修改成功', res.errmsg || '修改失败');
  129. },
  130. },
  131. computed: {
  132. ...mapState(['user', 'menuParams']),
  133. pageTitle() {
  134. return `${this.$route.meta.title}`;
  135. },
  136. },
  137. metaInfo() {
  138. return { title: this.$route.meta.title };
  139. },
  140. };
  141. </script>
  142. <style lang="less" scoped>
  143. .leftTop {
  144. font-size: 18px;
  145. width: 96%;
  146. height: 41px;
  147. line-height: 35px;
  148. border-bottom: 1px solid #e5e5e5;
  149. position: relative;
  150. bottom: 1px;
  151. margin: 10px;
  152. font-weight: 600;
  153. color: #22529a;
  154. }
  155. .info {
  156. margin: 0 40px 15px 10px;
  157. border: 1px dashed #ccc;
  158. width: 96%;
  159. padding: 10px;
  160. .btn {
  161. text-align: center;
  162. margin: 10px 0;
  163. }
  164. }
  165. /deep/.el-form-item {
  166. margin-bottom: 0px;
  167. }
  168. /deep/.el-form-item__label {
  169. border: 1px solid #dcdfe6;
  170. }
  171. /deep/.el-radio-group {
  172. border: 1px solid #ccc;
  173. padding: 12px 20px;
  174. // width: 943px;
  175. }
  176. /deep/.el-input__inner {
  177. border-radius: 0;
  178. height: 42px;
  179. line-height: 42px;
  180. }
  181. /deep/.el-textarea__inner {
  182. border-radius: 0;
  183. height: 140px !important;
  184. }
  185. /deep/.langInfo .el-form-item__label {
  186. padding: 49px 0;
  187. }
  188. /deep/.langInfo .workexperience .textarea__inner {
  189. height: 140px !important;
  190. }
  191. </style>