index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <div class="app-container">
  3. <el-row>
  4. <!--练习列表111-->
  5. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  6. <el-form-item label="练习名称" prop="userName">
  7. <el-input
  8. v-model="queryParams.userName"
  9. placeholder="请输入练习名称"
  10. clearable
  11. style="width: 150px"
  12. @keyup.enter.native="handleQuery"
  13. />
  14. </el-form-item>
  15. <el-form-item label="练习时间">
  16. <el-date-picker
  17. v-model="dateRange"
  18. style="width: 240px"
  19. value-format="yyyy-MM-dd"
  20. type="daterange"
  21. range-separator="-"
  22. start-placeholder="开始日期"
  23. end-placeholder="结束日期"
  24. ></el-date-picker>
  25. </el-form-item>
  26. <el-form-item label="模拟器型号" prop="simType">
  27. <el-select
  28. v-model="queryParams.simType"
  29. placeholder="模拟器型号"
  30. clearable
  31. style="width: 240px"
  32. @keyup.enter.native="handleQuery"
  33. >
  34. <el-option
  35. v-for="dict in dict.type.sim_sim_type"
  36. :key="dict.value"
  37. :label="dict.label"
  38. :value="dict.value"
  39. />
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item label="练习状态" prop="status">
  43. <el-select
  44. v-model="queryParams.status"
  45. placeholder="练习状态"
  46. clearable
  47. style="width: 150px"
  48. >
  49. <el-option
  50. v-for="dict in dict.type.sys_normal_disable"
  51. :key="dict.value"
  52. :label="dict.label"
  53. :value="dict.value"
  54. />
  55. </el-select>
  56. </el-form-item>
  57. <el-form-item>
  58. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  59. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  60. </el-form-item>
  61. </el-form>
  62. <el-table v-loading="loading" :data="userList">
  63. <el-table-column type="selection" width="50" align="center" />
  64. <el-table-column label="练习名称" align="center" key="userName" prop="userName" v-if="columns[0].visible" :show-overflow-tooltip="true" />
  65. <el-table-column label="练习时间" align="center" key="kaoshiTime" prop="kaoshiTime" v-if="columns[1].visible" :show-overflow-tooltip="true" />
  66. <el-table-column label="模拟器型号" align="center" key="simType" prop="simType" v-if="columns[2].visible" :show-overflow-tooltip="true" >
  67. <template slot-scope="scope">
  68. <dict-tag class="text-navy" :options="dict.type.sim_sim_type" :value="scope.row.simType"/>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="创建老师" align="center" key="creater" prop="creater" v-if="columns[3].visible" :show-overflow-tooltip="true" />
  72. <el-table-column label="练习状态" align="center" key="status" v-if="columns[4].visible">
  73. <template slot-scope="scope">
  74. <el-switch
  75. v-model="scope.row.status"
  76. active-value="0"
  77. inactive-value="1"
  78. @change="handleStatusChange(scope.row)"
  79. ></el-switch>
  80. </template>
  81. </el-table-column>
  82. <el-table-column
  83. label="操作"
  84. align="center"
  85. width="160"
  86. class-name="small-padding fixed-width"
  87. >
  88. <template slot-scope="scope">
  89. <el-button
  90. size="mini"
  91. type="text"
  92. icon="el-icon-thumb"
  93. @click="handleInto(scope.row)"
  94. >进入</el-button>
  95. </template>
  96. </el-table-column>
  97. </el-table>
  98. <pagination
  99. v-show="total>0"
  100. :total="total"
  101. :page.sync="queryParams.pageNum"
  102. :limit.sync="queryParams.pageSize"
  103. @pagination="getList"
  104. />
  105. </el-row>
  106. </div>
  107. </template>
  108. <style>
  109. .el-form-item__label{
  110. width: 85px !important;
  111. }
  112. </style>
  113. <script>
  114. import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
  115. export default {
  116. dicts: ['sim_sim_type'],
  117. data() {
  118. return {
  119. // 遮罩层
  120. loading: true,
  121. // 选中数组
  122. ids: [],
  123. // 非单个禁用
  124. single: true,
  125. // 非多个禁用
  126. multiple: true,
  127. // 显示搜索条件
  128. showSearch: true,
  129. // 总条数
  130. total: 0,
  131. // 用户表格数据
  132. userList: null,
  133. // 弹出层标题
  134. title: "",
  135. // 日期范围
  136. dateRange: [],
  137. // 岗位选项
  138. postOptions: [],
  139. // 角色选项
  140. roleOptions: [],
  141. // 表单参数
  142. form: {},
  143. defaultProps: {
  144. children: "children",
  145. label: "label"
  146. },
  147. // 查询参数
  148. queryParams: {
  149. pageNum: 1,
  150. pageSize: 10,
  151. userName: undefined,
  152. phonenumber: undefined,
  153. status: undefined,
  154. deptId: undefined
  155. },
  156. // 列信息
  157. columns: [
  158. { key: 0, label: `练习名称`, visible: true },
  159. { key: 1, label: `练习时间`, visible: true },
  160. { key: 2, label: `模拟器类型`, visible: true },
  161. { key: 3, label: `练习状态`, visible: true },
  162. { key: 4, label: `创建老师`, visible: true },
  163. ],
  164. // 表单校验
  165. rules: {
  166. }
  167. };
  168. },
  169. watch: {
  170. },
  171. created() {
  172. this.getList();
  173. this.getConfigKey("sys.user.initPassword").then(response => {
  174. this.initPassword = response.msg;
  175. });
  176. },
  177. methods: {
  178. /** 查询用户列表 */
  179. getList() {
  180. this.loading = true;
  181. listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  182. //将返回值注释
  183. this.userList = response.rows;
  184. this.total = response.total;
  185. this.loading = false;
  186. }
  187. );
  188. },
  189. // 筛选节点
  190. filterNode(value, data) {
  191. if (!value) return true;
  192. return data.label.indexOf(value) !== -1;
  193. },
  194. // 节点单击事件
  195. handleNodeClick(data) {
  196. this.queryParams.deptId = data.id;
  197. this.handleQuery();
  198. },
  199. // 用户状态修改
  200. handleStatusChange(row) {
  201. let text = row.status === "0" ? "启用" : "停用";
  202. this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
  203. return changeUserStatus(row.userId, row.status);
  204. }).then(() => {
  205. this.$modal.msgSuccess(text + "成功");
  206. }).catch(function() {
  207. row.status = row.status === "0" ? "1" : "0";
  208. });
  209. },
  210. // 取消按钮
  211. cancel() {
  212. this.open = false;
  213. this.zijianopen = false;
  214. this.reset();
  215. },
  216. // 表单重置
  217. reset() {
  218. this.form = {
  219. userId: undefined,
  220. deptId: undefined,
  221. userName: undefined,
  222. password: undefined,
  223. phonenumber: undefined,
  224. email: undefined,
  225. sex: undefined,
  226. status: "0",
  227. remark: undefined,
  228. postIds: [],
  229. roleIds: []
  230. };
  231. this.resetForm("form");
  232. },
  233. /** 搜索按钮操作 */
  234. handleQuery() {
  235. this.queryParams.pageNum = 1;
  236. this.getList();
  237. },
  238. /** 重置按钮操作 */
  239. resetQuery() {
  240. this.dateRange = [];
  241. this.resetForm("queryForm");
  242. this.queryParams.deptId = undefined;
  243. this.$refs.tree.setCurrentKey(null);
  244. this.handleQuery();
  245. },
  246. /** 进入操作 */
  247. handleInto: function(row) {
  248. const userId = row.userId;
  249. console.log(userId)
  250. this.$router.push("/people/train-train1/trainid/" + userId);
  251. },
  252. }
  253. };
  254. </script>