| | |
| | | </template> |
| | | <template v-if="$slots.table"> |
| | | <Table :data="tableData" :total="total" :height="height" :queryForm="queryForm" |
| | | @currentChange="handleCurrentChange" @sizeChange="handleSizeChange"> |
| | | @handleCurrentChange="handleCurrentChange" @handleSizeChange="handleSizeChange"> |
| | | <slot name="table"></slot> |
| | | </Table> |
| | | </template> |
| | |
| | | }, |
| | | }, |
| | | data() { |
| | | var validatePhone = (rule, value, callback) => { |
| | | if (!value) { |
| | | // The 'required' rule will handle empty value, so we can make this optional here |
| | | // or keep it for a more specific message if needed. |
| | | // For now, let's assume 'required' handles the empty case. |
| | | callback(); |
| | | return; |
| | | } |
| | | const phoneRegex = new RegExp(/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/,'g'); // Regex for 11-digit Chinese mobile numbers |
| | | if (!phoneRegex.test(value)) { |
| | | callback(new Error('请输入有效的11位手机号码')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | form: { status: true }, |
| | | userDeptId: '', |
| | | rules: { |
| | | nickName: [{ required: true, message: '请输入姓名', trigger: 'blur' }], |
| | | phonenumber: [{ required: true, message: '请输入联系电话', trigger: 'blur' }], |
| | | roleId: [{ required: true, message: '请选择角色', trigger: 'blur' }], |
| | | phonenumber: [ |
| | | { required: true, message: '请输入联系电话', trigger: 'blur' }, |
| | | { validator: validatePhone, trigger: 'blur' } |
| | | ], |
| | | roleId: [{ required: true, message: '请选择角色', trigger: 'change' }], |
| | | userName: [{ required: true, message: '请输入登陆账号', trigger: 'blur' }], |
| | | status: [{ required: true, message: '请选择启动状态', trigger: 'blur' }], |
| | | }, |
| | | } |
| | | }, |
| | | created() { |
| | | this.form = { status: true } |
| | | |
| | | if (Object.keys(this.row).length) { |
| | | if (this.row && this.row.userId) { |
| | | this.form = { |
| | | userId: this.row.userId, |
| | | nickName: this.row.nickName, |
| | | phonenumber: this.row.phonenumber, |
| | | roleId: this.row.roleId, |
| | | userName: this.row.userName, |
| | | remark: this.row.remark, |
| | | ...this.row, |
| | | status: this.row.status == 0 ? true : false, |
| | | } |
| | | } else { |
| | | this.form = {} |
| | | this.form = { |
| | | nickName: '', |
| | | phonenumber: '', |
| | | userName: '', |
| | | roleId: '', |
| | | status: true, |
| | | remark: '', |
| | | } |
| | | } |
| | | }, |
| | | mounted() { }, |
| | |
| | | <el-dialog :visible.sync="dialogVisible" @close="$emit('close')" title="重置密码" width="30%"> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form-item label="姓名" prop="nickName"> |
| | | <el-input :disabled="true" v-model="form.nickName" placeholder="请输入" style="width: 50%;"></el-input> |
| | | <el-input :disabled="true" v-model="form.nickName" placeholder="请输入" style="width: 95%;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="登陆账号" prop="account"> |
| | | <el-input :disabled="true" v-model="form.account" placeholder="请输入" style="width: 50%;"></el-input> |
| | | <el-input :disabled="true" v-model="form.account" placeholder="请输入" style="width: 95%;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="新密码" prop="password"> |
| | | <el-input v-model="form.password" placeholder="请输入" style="width: 50%;"></el-input> |
| | | <el-input v-model="form.password" type="password" placeholder="请输入" style="width: 95%;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="确认密码" prop="confirmPassword"> |
| | | <el-input v-model="form.confirmPassword" placeholder="请输入" style="width: 50%;"></el-input> |
| | | <el-input v-model="form.confirmPassword" type="password" placeholder="请输入" style="width: 95%;"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="select-member-footer"> |
| | |
| | | <template> |
| | | <div class="list"> |
| | | <TableCustom :queryForm="pagination" :tableData="data" :total="pagination.total" |
| | | @currentChange="handleCurrentChange" @sizeChange="handleSizeChange"> |
| | | @handleCurrentChange="handleCurrentChange" @handleSizeChange="handleSizeChange"> |
| | | <template #search> |
| | | <el-form label-width="100px" inline> |
| | | <el-form-item label="人员搜索"> |
| | |
| | | </el-form-item> |
| | | <el-form-item style="margin-left: 63px;"> |
| | | <el-button @click="reset">重置</el-button> |
| | | <el-button type="primary" @click="onSubmit">查询</el-button> |
| | | <el-button type="primary" @click="onSubmit" style="margin-left: 10px;">查询</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | |
| | | <div class="status_class"> |
| | | <div :class="row.status == 0 ? 'green' : 'red'"></div> |
| | | <div>{{ row.status == 0 ? '正常' : '禁用' }}</div> |
| | | <div v-if="row.status == 1" style="cursor: pointer" |
| | | @click="; (dialogVisibleView = true), (rowView = row), $forceUpdate()"> |
| | | <i class="el-icon-warning"></i> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-table-column label="操作" width="300"> |
| | | <template slot-scope="{ row }"> |
| | | <div> |
| | | <el-button type="text" @click="edit(row)">编辑</el-button> |
| | | <el-button type="text" @click="edit(row)">账号继承</el-button> |
| | | <el-button v-if="row.status != 0" type="text" @click="updateStatus(row, true)"> |
| | | <el-button type="text" @click="edit(row)" class="action-button">编辑</el-button> |
| | | <el-button type="text" @click="inherit(row)" class="action-button">账号继承</el-button> |
| | | <el-button v-if="row.status != 0" type="text" @click="updateStatus(row, true)" class="action-button"> |
| | | 启用 |
| | | </el-button> |
| | | <el-button v-if="row.status == 0" type="text" @click="updateStatus(row, false)"> |
| | | <el-button v-if="row.status == 0" type="text" @click="updateStatus(row, false)" class="action-button"> |
| | | 禁用 |
| | | </el-button> |
| | | <el-button type="text" @click="detail(row)">重置密码</el-button> |
| | | <el-button type="text" @click="del(row)">删除</el-button> |
| | | <el-button type="text" @click="detail(row)" class="action-button">重置密码</el-button> |
| | | <el-button type="text" @click="del(row)" class="action-button">删除</el-button> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </TableCustom> |
| | | |
| | | <AddEdit v-if="dialogVisible" :row="row" :deptList="deptList" :deptType="deptTypeList" :roleList="roleList" |
| | | <AddEdit v-if="dialogVisible" :row="row" :deptType="deptTypeList" :roleList="roleList" |
| | | :dialogVisible="dialogVisible" @close="dialogVisible = false, row = {}" @confirm="confirm" /> |
| | | <ResetPassword v-if="passwordVisible" :row="row" :dialogVisible="passwordVisible" |
| | | @close="passwordVisible = false, row = {}" @confirm="passwordConfirm" /> |
| | | <ViewData v-if="dialogVisibleView" :row="rowView" :dialogVisible="dialogVisibleView" |
| | | @close="dialogVisibleView = false, rowView = {}" /> |
| | | <Disb v-if="disbDialogVisible" :row="disbRow" :dialogVisible="disbDialogVisible" |
| | | @close="disbDialogVisible = false, disbRow = {}" @confirm="disbConfirm" /> |
| | | <ShowDelConfirm :show="delShow" @close="delShow = false" @confirm="delConfirm" title="确认要删除该人员吗?" |
| | |
| | | <script> |
| | | import { getList, add, edit, delDept, roleList, updatePwd, changeStatus, typeList } from './service' |
| | | import AddEdit from './components/add-edit.vue' |
| | | import ViewData from './components/view-data.vue' |
| | | import Disb from './components/disb.vue' |
| | | import ResetPassword from './components/reset-password.vue' |
| | | import Inherit from './components/inherit.vue' |
| | |
| | | name: 'User', |
| | | components: { |
| | | AddEdit, |
| | | ViewData, |
| | | Disb, |
| | | ResetPassword, |
| | | Inherit, |
| | |
| | | }, |
| | | watch: {}, |
| | | created() { |
| | | // this.getRoleList() |
| | | // this.getListData() |
| | | // this.getTypeList() |
| | | this.getRoleList() |
| | | this.getListData() |
| | | }, |
| | | mounted() { }, |
| | | methods: { |
| | |
| | | }, |
| | | getRoleList() { |
| | | roleList().then((res) => { |
| | | this.roleList = res.data.data |
| | | this.roleList = res |
| | | }) |
| | | }, |
| | | delConfirm() { |
| | |
| | | this.row = row |
| | | this.dialogVisible = true |
| | | }, |
| | | inherit(row) { |
| | | this.inheritRow = row |
| | | this.inheritDialogVisible = true |
| | | }, |
| | | updateStatus(row, type) { |
| | | if (type) { |
| | | changeStatus({ ...row, status: 0 }).then(() => { |
| | |
| | | status: this.status, |
| | | } |
| | | this.listLoading = true |
| | | const { |
| | | data: { |
| | | data: { records, total }, |
| | | }, |
| | | } = await getList(obj) |
| | | const { records,total } = await getList(obj) |
| | | this.data = records |
| | | this.pagination.total = total |
| | | this.timeOutID = setTimeout(() => { |
| | |
| | | height: 100%; |
| | | } |
| | | |
| | | .action-button { |
| | | margin-right: 8px; |
| | | } |
| | | |
| | | .green { |
| | | background-color: green; |
| | | } |
| | |
| | | |
| | | // 添加 |
| | | export const add = (data) => { |
| | | return axios.post('/system/user/add', { ...data }) |
| | | return axios.post('/api/system/user/add', { ...data }) |
| | | } |
| | | |
| | | // 编辑 |
| | | export const edit = (data) => { |
| | | return axios.post('/system/user/edit', { ...data }) |
| | | return axios.post('/api/system/user/edit', { ...data }) |
| | | } |
| | | |
| | | // 删除 |
| | |
| | | } |
| | | |
| | | export const updatePwd = (data) => { |
| | | return axios.post(`/system/user/resetPwd`, { ...data }) |
| | | return axios.post(`/api/system/user/resetPwd`, { ...data }) |
| | | } |
| | | export const typeList = (data) => { |
| | | export const typeList = () => { |
| | | return axios.get(`/t-business-dept/list/type?type=1`,) |
| | | } |