stationComment.jsp 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  2. <html>
  3. <head>
  4. <jsp:include page="head.jsp"/>
  5. <title>领先共享汽车</title>
  6. <style>.avatar-uploader .el-upload {
  7. border: 1px dashed #d9d9d9;
  8. border-radius: 6px;
  9. cursor: pointer;
  10. position: relative;
  11. overflow: hidden;
  12. }
  13. .avatar-uploader .el-upload:hover {
  14. border-color: #20a0ff;
  15. }
  16. .avatar-uploader-icon {
  17. font-size: 28px;
  18. color: #8c939d;
  19. width: 178px;
  20. height: 178px;
  21. line-height: 178px;
  22. text-align: center;
  23. }
  24. .avatar {
  25. width: 178px;
  26. height: 178px;
  27. display: block;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <jsp:include page="contentBefore.jsp"/>
  33. <template>
  34. <el-form ref="form" :model="row_info" label-width="80px">
  35. <el-form-item
  36. label="用户">
  37. <el-select v-model="row_info.userId" clearable filterable placeholder="请选择用户">
  38. <el-option
  39. v-for="item in userInfos"
  40. :key="item.id"
  41. :label="item.nickName"
  42. :value="item.id">
  43. </el-option>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item
  47. label="场地">
  48. <el-select v-model="row_info.stationId" clearable filterable placeholder="请选择场地">
  49. <el-option
  50. v-for="item in stationInfos"
  51. :key="item.id"
  52. :label="item.title"
  53. :value="item.id">
  54. </el-option>
  55. </el-select>
  56. </el-form-item>
  57. <el-form-item
  58. label="快速评价">
  59. <el-select v-model="row_info.quickId" clearable filterable placeholder="请选择快速评价">
  60. <el-option
  61. v-for="item in quickComments"
  62. :key="item.id"
  63. :label="item.comment"
  64. :value="item.id">
  65. </el-option>
  66. </el-select>
  67. </el-form-item>
  68. <el-form-item label="订单id">
  69. <el-input v-model="row_info.orderId"></el-input>
  70. </el-form-item>
  71. <el-form-item label="评价内容">
  72. <el-input v-model="row_info.content"></el-input>
  73. </el-form-item>
  74. <el-form-item label="星级">
  75. <el-input v-model="row_info.starLevel"></el-input>
  76. </el-form-item>
  77. <el-form-item>
  78. <el-button type="primary" @click="onSubmit">{{edit?'保存':'立即创建'}}</el-button>
  79. <el-button>取消</el-button>
  80. </el-form-item>
  81. </el-form>
  82. </template>
  83. <jsp:include page="contentAfter.jsp"/>
  84. </body>
  85. <script>
  86. function getQueryString(name) {
  87. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  88. var r = window.location.search.substr(1).match(reg);
  89. if (r != null) return unescape(r[2]);
  90. return null;
  91. }
  92. new Vue({
  93. el: '#app',
  94. created: function () {
  95. $.get({
  96. url: '../userInfo/all'
  97. }).then(function (res) {
  98. this.userInfos = res.data;
  99. }.bind(this));
  100. $.get({
  101. url: '../stationInfo/all'
  102. }).then(function (res) {
  103. this.stationInfos = res.data;
  104. }.bind(this));
  105. $.get({
  106. url: '../quickComment/all'
  107. }).then(function (res) {
  108. this.quickComments = res.data;
  109. }.bind(this));
  110. var id = getQueryString('id');
  111. if (id) {
  112. $.get({
  113. url: '../stationComment/getStationComment',
  114. data: {
  115. id: id
  116. }
  117. }).then(function (res) {
  118. if (res.success) {
  119. this.edit = true;
  120. this.row_info = res.data;
  121. }
  122. }.bind(this));
  123. }
  124. },
  125. data: function () {
  126. return {
  127. menu: '7-2',
  128. user: {
  129. id: '',
  130. username: 'admin',
  131. avatar: ''
  132. },
  133. loading: false,
  134. edit: false,
  135. tab: 1,
  136. row_info : {},
  137. userInfos : [],
  138. stationInfos : [],
  139. quickComments : [],
  140. };
  141. },
  142. methods: {
  143. logout: function () {
  144. this.$confirm('确定要注销吗?', '提示', {
  145. confirmButtonText: '确定',
  146. cancelButtonText: '取消',
  147. type: 'info'
  148. }).then(function () {
  149. localStorage.removeItem('user');
  150. this.$router.push({path: '/login'});
  151. }.bind(this)).catch(function (e) {
  152. });
  153. },
  154. onSubmit: function () {
  155. if (!this.row_info.stationId) {
  156. this.$message.warning('请填选择场地');
  157. } else {
  158. var data = JSON.parse(JSON.stringify(this.row_info));
  159. $.post({
  160. url: this.edit ? '../stationComment/update' : '../stationComment/save',
  161. data: data
  162. }).then(function (res) {
  163. if (res.success) {
  164. if (!this.edit) {
  165. this.row_info.id = res.data;
  166. }
  167. this.edit = true;
  168. this.$message.success(this.edit ? '保存成功' : '创建成功');
  169. } else {
  170. this.$message.error(this.edit ? '保存失败' : '创建失败');
  171. }
  172. }.bind(this))
  173. }
  174. },
  175. }
  176. })
  177. </script>
  178. </html>