123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- <template>
- <div class="app-container">
- <el-row>
- <!--练习列表111-->
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
- <el-form-item label="练习名称" prop="userName">
- <el-input
- v-model="queryParams.userName"
- placeholder="请输入练习名称"
- clearable
- style="width: 150px"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="练习时间">
- <el-date-picker
- v-model="dateRange"
- style="width: 240px"
- value-format="yyyy-MM-dd"
- type="daterange"
- range-separator="-"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- ></el-date-picker>
- </el-form-item>
- <el-form-item label="模拟器型号" prop="simType">
- <el-select
- v-model="queryParams.simType"
- placeholder="模拟器型号"
- clearable
- style="width: 240px"
- @keyup.enter.native="handleQuery"
- >
- <el-option
- v-for="dict in dict.type.sim_sim_type"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="练习状态" prop="status">
- <el-select
- v-model="queryParams.status"
- placeholder="练习状态"
- clearable
- style="width: 150px"
- >
- <el-option
- v-for="dict in dict.type.sys_normal_disable"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
-
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-table v-loading="loading" :data="userList">
- <el-table-column type="selection" width="50" align="center" />
- <el-table-column label="练习名称" align="center" key="userName" prop="userName" v-if="columns[0].visible" :show-overflow-tooltip="true" />
- <el-table-column label="练习时间" align="center" key="kaoshiTime" prop="kaoshiTime" v-if="columns[1].visible" :show-overflow-tooltip="true" />
- <el-table-column label="模拟器型号" align="center" key="simType" prop="simType" v-if="columns[2].visible" :show-overflow-tooltip="true" >
- <template slot-scope="scope">
- <dict-tag class="text-navy" :options="dict.type.sim_sim_type" :value="scope.row.simType"/>
- </template>
- </el-table-column>
- <el-table-column label="创建老师" align="center" key="creater" prop="creater" v-if="columns[3].visible" :show-overflow-tooltip="true" />
- <el-table-column label="练习状态" align="center" key="status" v-if="columns[4].visible">
- <template slot-scope="scope">
- <el-switch
- v-model="scope.row.status"
- active-value="0"
- inactive-value="1"
- @change="handleStatusChange(scope.row)"
- ></el-switch>
- </template>
- </el-table-column>
- <el-table-column
- label="操作"
- align="center"
- width="160"
- class-name="small-padding fixed-width"
- >
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-thumb"
- @click="handleInto(scope.row)"
- >进入</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </el-row>
- </div>
- </template>
- <style>
- .el-form-item__label{
- width: 85px !important;
- }
- </style>
- <script>
- import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
- export default {
- dicts: ['sim_sim_type'],
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 用户表格数据
- userList: null,
- // 弹出层标题
- title: "",
- // 日期范围
- dateRange: [],
- // 岗位选项
- postOptions: [],
- // 角色选项
- roleOptions: [],
- // 表单参数
- form: {},
- defaultProps: {
- children: "children",
- label: "label"
- },
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- userName: undefined,
- phonenumber: undefined,
- status: undefined,
- deptId: undefined
- },
- // 列信息
- columns: [
- { key: 0, label: `练习名称`, visible: true },
- { key: 1, label: `练习时间`, visible: true },
- { key: 2, label: `模拟器类型`, visible: true },
- { key: 3, label: `练习状态`, visible: true },
- { key: 4, label: `创建老师`, visible: true },
- ],
- // 表单校验
- rules: {
- }
- };
- },
- watch: {
-
- },
- created() {
- this.getList();
- this.getConfigKey("sys.user.initPassword").then(response => {
- this.initPassword = response.msg;
- });
- },
- methods: {
- /** 查询用户列表 */
- getList() {
- this.loading = true;
- listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
- //将返回值注释
- this.userList = response.rows;
- this.total = response.total;
- this.loading = false;
- }
- );
- },
- // 筛选节点
- filterNode(value, data) {
- if (!value) return true;
- return data.label.indexOf(value) !== -1;
- },
- // 节点单击事件
- handleNodeClick(data) {
- this.queryParams.deptId = data.id;
- this.handleQuery();
- },
- // 用户状态修改
- handleStatusChange(row) {
- let text = row.status === "0" ? "启用" : "停用";
- this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
- return changeUserStatus(row.userId, row.status);
- }).then(() => {
- this.$modal.msgSuccess(text + "成功");
- }).catch(function() {
- row.status = row.status === "0" ? "1" : "0";
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.zijianopen = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- userId: undefined,
- deptId: undefined,
- userName: undefined,
-
- password: undefined,
- phonenumber: undefined,
- email: undefined,
- sex: undefined,
- status: "0",
- remark: undefined,
- postIds: [],
- roleIds: []
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.dateRange = [];
- this.resetForm("queryForm");
- this.queryParams.deptId = undefined;
- this.$refs.tree.setCurrentKey(null);
- this.handleQuery();
- },
- /** 进入操作 */
- handleInto: function(row) {
- const userId = row.userId;
- console.log(userId)
- this.$router.push("/people/train-train1/trainid/" + userId);
- },
-
- }
- };
- </script>
|