| | |
| | | <div class="search-bar"> |
| | | <el-form ref="form" :inline="true"> |
| | | <el-form-item> |
| | | <el-input v-model="keyword" placeholder="请输入人员名称"> |
| | | <el-input size="small" v-model="keyword" placeholder="请输入人员名称"> |
| | | <i slot="prefix" class="el-input__icon el-icon-search" /> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getData()">查询</el-button> |
| | | <el-button type="primary" plain @click="resetData()">重置</el-button> |
| | | <el-button size="small" type="primary" @click="getData()">查询</el-button> |
| | | <el-button size="small" type="primary" plain @click="resetData()">重置</el-button> |
| | | <!-- <el-button type="text">高级搜索<i class="el-icon-arrow-down el-icon--right" /></el-button> --> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="serve-btn"> |
| | | <el-button type="primary" icon="el-icon-plus" @click="dialogFormVisible = true">新增人员</el-button> |
| | | <el-button size="small" type="primary" icon="el-icon-plus" @click="dialogFormVisible = true">新增人员</el-button> |
| | | <el-dialog :title="isUpdate == true ? '更新人员信息' : '新增人员'" :visible.sync="dialogFormVisible" width="30%"> |
| | | <el-form :model="form" ref="form" :rules="rules" style="padding-right: 50px;"> |
| | | <el-form-item label="账号" :label-width="formLabelWidth" prop="account"> |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="在职状态" v-if="isUpdate" :label-width="formLabelWidth" prop="jobState"> |
| | | <el-select v-model="form.jobState" clearable style="width: 100%" placeholder="请选择在职状态"> |
| | | <el-option v-for="(item,index) in jobList" :key="index" :label="item.label" :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible = false">取 消</el-button> |
| | |
| | | </div> |
| | | <div class="content-main"> |
| | | <div class="personner-table"> |
| | | <el-table ref="personnerlTable" height="calc(100vh - 240px)" border :cell-style="{ textAlign: 'center' }" |
| | | <el-table ref="personnerlTable" height="calc(100vh - 240px)" border :cell-style="{ textAlign: 'left' }" |
| | | :header-cell-style="{ |
| | | border: '0px', |
| | | background: '#f5f7fa', |
| | | color: '#606266', |
| | | boxShadow: 'inset 0 1px 0 #ebeef5', |
| | | textAlign: 'center', |
| | | textAlign: 'left', |
| | | }" @filter-change="fnFilterChangeInit" :data="personnerlTable" style="width: 100%"> |
| | | <el-table-column prop="username" label="角色名称" min-width="120" /> |
| | | <el-table-column prop="roleName" label="角色权限" min-width="120" /> |
| | |
| | | }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="jobState" label="在职状态" min-width="120" :filters="[ |
| | | { text: '在职', value: 1 }, |
| | | { text: '离岗', value: 0 }, |
| | | ]" column-key="status" :filter-method="filterTag" filter-placement="bottom-end"> |
| | | <el-table-column prop="jobState" label="在职状态" min-width="120" :filters="[{ text: '在职', value: 1 },{ text: '离岗', value: 0 },]" |
| | | column-key="status" :filter-method="filterTag" filter-placement="bottom-end"> |
| | | <template slot-scope="scope"> |
| | | <el-tag :type="scope.row.jobState === 0 ? 'danger' : 'success'" |
| | | disable-transitions>{{ scope.row.jobState === 0 ? "离岗" : "在职" }}</el-tag> |
| | |
| | | personData: [], // 用来存放接口传过来的人员列表数据 |
| | | dialogFormVisible: false, |
| | | form: { |
| | | id: "", |
| | | account: "", |
| | | age: "", |
| | | email: "", |
| | |
| | | phone: "", |
| | | organizationId: "", |
| | | roleId: "", |
| | | jobState: "", |
| | | }, |
| | | jobList:[{ label: '在职', value: 1 },{ label: '离岗', value: 0 }], |
| | | myProp: { |
| | | value: "id", |
| | | label: "department", |
| | |
| | | }, ], |
| | | roleId: [{ |
| | | required: true, |
| | | message: "请输入权限(0或1)", |
| | | message: "请选择人员权限", |
| | | trigger: "blur" |
| | | }, ], |
| | | }, |
| | |
| | | this.currentPage = 1; |
| | | this.pageSize = val; |
| | | }, |
| | | filterTag(value) { |
| | | this.status = ""; |
| | | this.status = value; |
| | | return true; |
| | | filterTag(value,row) { |
| | | // console.log("filterTag--",value); |
| | | // this.status = ""; |
| | | // this.status = value; |
| | | return row.jobState === value; |
| | | }, |
| | | // 当前页改变时触发 跳转其他页 |
| | | handleCurrentChange(val) { |
| | |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | let departmentId = this.form.organizationId; |
| | | this.form.organizationId = departmentId[departmentId.length - 1]; |
| | | let form = { |
| | | id: this.form.id, |
| | | account: this.form.account, |
| | | age: this.form.age, |
| | | email: this.form.email, |
| | | name: this.form.name, |
| | | phone: this.form.phone, |
| | | organizationId: departmentId[departmentId.length - 1], |
| | | roleId: this.form.roleId, |
| | | jobState: this.form.jobState |
| | | } |
| | | if (!this.isUpdate) { |
| | | post("/user/add_new_personnel", this.form).then((response) => { |
| | | post("/user/add_new_personnel", form).then((response) => { |
| | | this.$message({ |
| | | message: response.message, |
| | | type: "success", |
| | | }); |
| | | this.dialogFormVisible = false; |
| | | this.getData(); |
| | | }).catch((error)=>{ |
| | | this.$message.error(error.message); |
| | | }); |
| | | } else { |
| | | put("/user/update_new_personnel", this.form).then((res) => { |
| | | put("/user/update_new_personnel", form).then((res) => { |
| | | this.$message({ |
| | | message: res.message, |
| | | type: "success", |
| | | }); |
| | | this.dialogFormVisible = false; |
| | | this.getData(); |
| | | }).catch((error)=>{ |
| | | this.$message.error(error.message); |
| | | }); |
| | | } |
| | | } else { |
| | |
| | | }, |
| | | |
| | | handleClick(row) { |
| | | console.log(row); |
| | | this.isUpdate = true; |
| | | this.dialogFormVisible = true; |
| | | this.form.name = row.username; |
| | |
| | | this.form.phone = row.phone; |
| | | this.form.id = row.id; |
| | | this.form.email = row.email; |
| | | this.form.jobState = row.jobState; |
| | | this.form.organizationId = this.getParentsById( |
| | | this.options, |
| | | row.departmentId |
| | | ); |
| | | this.form.roleId = row.roleName; |
| | | this.form.roleId = row.roleId; |
| | | this.form.age = row.age; |
| | | this.form.account = row.account; |
| | | }, |
| | |
| | | handler(newVal, oldVal) { |
| | | if (newVal == false) { |
| | | this.isUpdate = false; |
| | | this.form = {}; |
| | | this.form = { |
| | | id: "", |
| | | account: "", |
| | | age: "", |
| | | email: "", |
| | | name: "", |
| | | phone: "", |
| | | organizationId: "", |
| | | roleId: "", |
| | | jobState: "", |
| | | }; |
| | | this.$refs.form.resetFields(); |
| | | } else { |
| | | this.getRoleList(); |