index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <div class="app-container">
  3. <el-form v-show="showSearch" ref="queryForm" :model="queryParams" :inline="true" label-width="68px">
  4. <el-form-item label="用户id" prop="userId">
  5. <el-input v-model="queryParams.userId" placeholder="请输入用户id" clearable size="small" @keyup.enter.native="handleQuery" />
  6. </el-form-item>
  7. <el-form-item label="状态" prop="status">
  8. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  9. <el-option
  10. v-for="item in $store.getters.dictObj('data_status_query').option"
  11. :key="item.dictValue"
  12. :label="item.dictLabel"
  13. :value="item.dictValue"
  14. />
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item>
  18. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  19. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  20. </el-form-item>
  21. </el-form>
  22. <el-row :gutter="10" class="mb8">
  23. <el-col :span="1.5">
  24. <el-button v-hasPermi="['coach:evaluate:add']" type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
  25. </el-col>
  26. <el-col :span="1.5">
  27. <el-button v-hasPermi="['coach:evaluate:edit']" type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
  28. >修改</el-button
  29. >
  30. </el-col>
  31. <el-col :span="1.5">
  32. <el-button v-hasPermi="['coach:evaluate:remove']" type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
  33. >删除</el-button
  34. >
  35. </el-col>
  36. <el-col :span="1.5">
  37. <el-button v-hasPermi="['coach:evaluate:export']" type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
  38. </el-col>
  39. <right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
  40. </el-row>
  41. <el-table v-loading="loading" :data="evaluateList" @selection-change="handleSelectionChange">
  42. <el-table-column type="selection" width="55" align="center" />
  43. <el-table-column label="id" align="center" prop="id" />
  44. <el-table-column label="评价内容" align="center" prop="content" />
  45. <el-table-column label="教练姓名" align="center" prop="coachName" />
  46. <el-table-column label="用户名" align="center" prop="userName" />
  47. <el-table-column label="手机号" align="center" prop="userPhone" />
  48. <el-table-column label="提交时间" align="center" prop="createTime" />
  49. <el-table-column label="总体星级" align="center" prop="totalStars" min-width="150">
  50. <template slot-scope="scope">
  51. <el-rate :value="scope.row.totalStars" disabled />
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  55. <template slot-scope="scope">
  56. <el-button v-hasPermi="['coach:evaluate:edit']" size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  57. >详情</el-button
  58. >
  59. <el-button v-hasPermi="['coach:evaluate:edit']" size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  60. >修改</el-button
  61. >
  62. <el-button v-hasPermi="['coach:evaluate:remove']" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  63. >删除</el-button
  64. >
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  69. <!-- 添加或修改教练评价对话框 -->
  70. <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
  71. <el-form ref="form" :model="form" :rules="rules" size="medium" label-width="100px" label-position="top" class="dialogFrom">
  72. <el-row gutter="15">
  73. <el-form-item label="评价内容" prop="content">
  74. <el-input
  75. v-model="form.content"
  76. type="textarea"
  77. placeholder="请输入评价内容"
  78. :autosize="{ minRows: 4, maxRows: 4 }"
  79. :style="{ width: '100%' }"
  80. ></el-input>
  81. </el-form-item>
  82. <el-form-item label="图片" prop="field158">
  83. <el-input v-model="form.field158" placeholder="请输入图片" clearable :style="{ width: '100%' }"> </el-input>
  84. </el-form-item>
  85. </el-row>
  86. <el-row type="flex" justify="center" align="top" gutter="15">
  87. <el-col :span="8">
  88. <el-form-item label="总体评价" prop="totalStars">
  89. <el-rate v-model="form.totalStars"></el-rate>
  90. </el-form-item>
  91. </el-col>
  92. <el-col :span="8">
  93. <el-form-item label="训练场地" prop="totalStars">
  94. <el-rate v-model="form.totalStars"></el-rate>
  95. </el-form-item>
  96. </el-col>
  97. <el-col :span="8">
  98. <el-form-item label="服务态度" prop="totalStars">
  99. <el-rate v-model="form.totalStars"></el-rate>
  100. </el-form-item>
  101. </el-col>
  102. </el-row>
  103. <el-row gutter="15">
  104. <el-col :span="8">
  105. <el-form-item label="用户名" prop="userName">
  106. <el-input v-model="form.userName" placeholder="请输入用户名" clearable :style="{ width: '100%' }"> </el-input>
  107. </el-form-item>
  108. </el-col>
  109. <el-col :span="8">
  110. <el-form-item label="手机号" prop="userPhone">
  111. <el-input v-model="form.userPhone" placeholder="请输入手机号" clearable :style="{ width: '100%' }"> </el-input>
  112. </el-form-item>
  113. </el-col>
  114. <el-col :span="8">
  115. <el-form-item label="提交时间" prop="createTime">
  116. <el-input v-model="form.createTime" placeholder="请输入提交时间" clearable :style="{ width: '100%' }"> </el-input>
  117. </el-form-item>
  118. </el-col>
  119. </el-row>
  120. </el-form>
  121. <div slot="footer" class="dialog-footer">
  122. <el-button type="primary" @click="submitForm">确 定</el-button>
  123. <el-button @click="cancel">取 消</el-button>
  124. </div>
  125. </el-dialog>
  126. </div>
  127. </template>
  128. <script>
  129. import { listEvaluate, getEvaluate, delEvaluate, addEvaluate, updateEvaluate, exportEvaluate } from '@/api/coach/evaluate'
  130. import Editor from '@/components/Editor'
  131. export default {
  132. name: 'Evaluate',
  133. components: { Editor },
  134. data() {
  135. return {
  136. //字典
  137. dict: {
  138. dictArr: [{ name: 'data_status_query', type: 1 }]
  139. },
  140. // 遮罩层
  141. loading: true,
  142. // 选中数组
  143. ids: [],
  144. // 非单个禁用
  145. single: true,
  146. // 非多个禁用
  147. multiple: true,
  148. // 显示搜索条件
  149. showSearch: true,
  150. // 总条数
  151. total: 0,
  152. // 教练评价表格数据
  153. evaluateList: [],
  154. // 弹出层标题
  155. title: '',
  156. // 是否显示弹出层
  157. open: false,
  158. // 查询参数
  159. queryParams: {
  160. pageNum: 1,
  161. pageSize: 10,
  162. userId: null,
  163. coachnum: null,
  164. attitudeStars: null,
  165. content: null,
  166. areaStars: null,
  167. totelStars: null,
  168. labelIds: null,
  169. isAnonymous: null,
  170. status: null
  171. },
  172. // 表单参数
  173. form: {},
  174. // 表单校验
  175. rules: {}
  176. }
  177. },
  178. created() {
  179. this.getList()
  180. },
  181. methods: {
  182. /** 查询教练评价列表 */
  183. getList() {
  184. this.loading = true
  185. listEvaluate(this.queryParams).then(response => {
  186. this.evaluateList = response.rows
  187. this.total = response.total
  188. this.loading = false
  189. })
  190. },
  191. // 取消按钮
  192. cancel() {
  193. this.open = false
  194. this.reset()
  195. },
  196. // 表单重置
  197. reset() {
  198. this.form = {
  199. id: null,
  200. userId: null,
  201. coachnum: null,
  202. attitudeStars: null,
  203. content: null,
  204. areaStars: null,
  205. totelStars: null,
  206. labelIds: null,
  207. createTime: null,
  208. updateTime: null,
  209. isAnonymous: null,
  210. status: 0
  211. }
  212. this.resetForm('form')
  213. },
  214. /** 搜索按钮操作 */
  215. handleQuery() {
  216. this.queryParams.pageNum = 1
  217. this.getList()
  218. },
  219. /** 重置按钮操作 */
  220. resetQuery() {
  221. this.resetForm('queryForm')
  222. this.handleQuery()
  223. },
  224. // 多选框选中数据
  225. handleSelectionChange(selection) {
  226. this.ids = selection.map(item => item.id)
  227. this.single = selection.length !== 1
  228. this.multiple = !selection.length
  229. },
  230. /** 新增按钮操作 */
  231. handleAdd() {
  232. this.reset()
  233. this.open = true
  234. this.title = '添加教练评价'
  235. },
  236. /** 修改按钮操作 */
  237. handleUpdate(row) {
  238. this.reset()
  239. const id = row.id || this.ids
  240. getEvaluate(id).then(response => {
  241. this.form = response.data
  242. this.open = true
  243. this.title = '修改教练评价'
  244. })
  245. },
  246. /** 提交按钮 */
  247. submitForm() {
  248. this.$refs['form'].validate(valid => {
  249. if (valid) {
  250. if (this.form.id != null) {
  251. updateEvaluate(this.form).then(response => {
  252. this.msgSuccess('修改成功')
  253. this.open = false
  254. this.getList()
  255. })
  256. } else {
  257. addEvaluate(this.form).then(response => {
  258. this.msgSuccess('新增成功')
  259. this.open = false
  260. this.getList()
  261. })
  262. }
  263. }
  264. })
  265. },
  266. /** 删除按钮操作 */
  267. handleDelete(row) {
  268. const ids = row.id || this.ids
  269. this.$confirm('是否确认删除教练评价编号为"' + ids + '"的数据项?', '警告', {
  270. confirmButtonText: '确定',
  271. cancelButtonText: '取消',
  272. type: 'warning'
  273. })
  274. .then(function() {
  275. return delEvaluate(ids)
  276. })
  277. .then(() => {
  278. this.getList()
  279. this.msgSuccess('删除成功')
  280. })
  281. },
  282. /** 导出按钮操作 */
  283. handleExport() {
  284. const queryParams = this.queryParams
  285. this.$confirm('是否确认导出所有教练评价数据项?', '警告', {
  286. confirmButtonText: '确定',
  287. cancelButtonText: '取消',
  288. type: 'warning'
  289. })
  290. .then(function() {
  291. return exportEvaluate(queryParams)
  292. })
  293. .then(response => {
  294. this.download(response.data)
  295. })
  296. }
  297. }
  298. }
  299. </script>
  300. <style lang="scss" scoped>
  301. @import '@/assets/styles/myscss.scss';
  302. </style>