employee search part1
This commit is contained in:
parent
64cd8cce4d
commit
9844ec1fad
|
@ -0,0 +1,9 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function genSignature(data) {
|
||||
return request({
|
||||
url: '/signature/',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
|
@ -82,10 +82,10 @@ export const asyncRoutes = [
|
|||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'qualification',
|
||||
name: 'Qualification',
|
||||
component: () => import('@/views/qualification/qualification'),
|
||||
meta: { title: '注册资格', icon: 'example', perms: ['qualification_view'] }
|
||||
path: 'qualification_',
|
||||
name: 'Qualification_',
|
||||
component: () => import('@/views/qualification/qualification_'),
|
||||
meta: { title: '注册资格检索', icon: 'example', perms: ['qualification_view'] }
|
||||
},
|
||||
]
|
||||
},
|
||||
|
|
|
@ -2,6 +2,21 @@
|
|||
<div class="app-container">
|
||||
<div style="display:flex">
|
||||
<treeselect v-model="listQuery.cert_field" :multiple="false" :options="cert_fieldOptions" :disable-branch-nodes="true" placeholder="认证领域" @input="handleFilter" style="width: 260px" clearable/>
|
||||
<el-select
|
||||
v-model="listQuery.afrom"
|
||||
placeholder="能力来源"
|
||||
clearable
|
||||
class="filter-item"
|
||||
@change="handleFilter"
|
||||
style="margin-left:10px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in afromOptions"
|
||||
:key="item.key"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="专业代码"
|
||||
|
@ -117,6 +132,7 @@ export default {
|
|||
is_enabled:true
|
||||
},
|
||||
cert_fieldOptions: [],
|
||||
afromOptions:[],
|
||||
formData:{},
|
||||
dgType:'create',
|
||||
dgVisiable:false
|
||||
|
@ -126,6 +142,7 @@ export default {
|
|||
this.listQuery.employee = this.employee
|
||||
this.getList();
|
||||
this.getTypeOptions()
|
||||
this.getafromOptions()
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
|
@ -143,6 +160,11 @@ export default {
|
|||
this.cert_fieldOptions = genTree(res.data)
|
||||
})
|
||||
},
|
||||
getafromOptions() {
|
||||
getDictList({type__code:'ability_from'}).then(res=>{
|
||||
this.afromOptions = genTree(res.data)
|
||||
})
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
|
|
|
@ -47,9 +47,8 @@
|
|||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="专业" prop="major" v-else>
|
||||
<el-form-item label="专业(PV)" prop="major" v-else-if="cert_field_code=='PV'">
|
||||
<treeselect
|
||||
v-if="cert_field_code == 'PV'"
|
||||
v-model="formData.major"
|
||||
:normalizer="normalizer"
|
||||
:multiple="false"
|
||||
|
@ -59,8 +58,9 @@
|
|||
:style="{width: '100%'}"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="专业(其它)" prop="major" v-else>
|
||||
<treeselect
|
||||
v-else
|
||||
v-model="formData.major"
|
||||
:normalizer="normalizer"
|
||||
:multiple="false"
|
||||
|
@ -177,7 +177,7 @@ export default {
|
|||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
// formData:'chooseDate'
|
||||
formData:'cert_change'
|
||||
},
|
||||
created() {
|
||||
if(this.formData.cert_field_){
|
||||
|
@ -201,6 +201,12 @@ export default {
|
|||
this.cert_field_code = node.code;
|
||||
console.log(this.cert_field_code);
|
||||
},
|
||||
cert_change(){
|
||||
if(this.formData.cert_field_){
|
||||
this.cert_field_code = this.formData.cert_field_.code
|
||||
}
|
||||
|
||||
},
|
||||
getafromOptions() {
|
||||
getDictList({ type__code: "ability_from" }).then(res => {
|
||||
this.afromOptions = genTree(res.data);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div style="margin-top:6px">
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate">新增</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
|
|
|
@ -72,21 +72,20 @@ export default {
|
|||
level: [{
|
||||
required: true,
|
||||
message: '请选择文化程度',
|
||||
trigger: 'change'
|
||||
trigger: 'blur'
|
||||
}],
|
||||
admission_date: [{
|
||||
required: true,
|
||||
message: '请选择入学日期',
|
||||
trigger: 'change'
|
||||
trigger: 'blur'
|
||||
}],
|
||||
graduation_date: [{
|
||||
required: true,
|
||||
message: '请选择毕业日期',
|
||||
trigger: 'change'
|
||||
trigger: 'blur'
|
||||
}],
|
||||
remark: [],
|
||||
},
|
||||
levelOptions: [],
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
|
|
|
@ -1,26 +1,40 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div style="display:flex">
|
||||
<treeselect v-model="listQuery.cert_field" :multiple="false" :options="typeOptions" placeholder="认证类型" @input="handleFilter" style="width: 260px" clearable/>
|
||||
<!-- <el-select
|
||||
v-model="listQuery.cert_field"
|
||||
placeholder="认证类型"
|
||||
<treeselect
|
||||
v-model="listQuery.user__dept"
|
||||
:multiple="false"
|
||||
:options="deptOptions"
|
||||
placeholder="所属组织"
|
||||
:disable-branch-nodes="true"
|
||||
@input="handleFilter"
|
||||
style="width: 280px" clearable/>
|
||||
<el-select
|
||||
v-model="listQuery.is_onjob"
|
||||
placeholder="是否在职"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
style="margin-left:10px"
|
||||
@change="handleFilter"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in typeOptions"
|
||||
:key="item.key"
|
||||
:label="item.display_name"
|
||||
:value="item.key"
|
||||
/>
|
||||
</el-select> -->
|
||||
<el-option label="是" value="true"/>
|
||||
<el-option label="否" value="false"/>
|
||||
</el-select>
|
||||
<el-select
|
||||
v-model="listQuery.is_fulltime"
|
||||
placeholder="是否全职"
|
||||
clearable
|
||||
class="filter-item"
|
||||
style="margin-left:10px"
|
||||
@change="handleFilter"
|
||||
>
|
||||
<el-option label="是" value="true"/>
|
||||
<el-option label="否" value="false"/>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="规则名称/编号"
|
||||
style="width: 300px;"
|
||||
placeholder="姓名/易记码/编号"
|
||||
style="width: 300px;margin-left:10px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
|
@ -29,10 +43,10 @@
|
|||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleFilter"
|
||||
style="margin-left:10px"
|
||||
>搜索</el-button>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
style="margin-left: 10px;"
|
||||
type="primary"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="resetFilter"
|
||||
|
@ -52,27 +66,30 @@
|
|||
max-height="600"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column align="header-center" label="编号">
|
||||
<el-table-column label="编号">
|
||||
<template slot-scope="scope">{{ scope.row.code }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="header-center" label="账号">
|
||||
<el-table-column label="账号">
|
||||
<template slot-scope="scope">{{ scope.row.user.username }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="名称">
|
||||
<el-table-column label="名称">
|
||||
<template slot-scope="scope">{{ scope.row.user.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="所属部门">
|
||||
<el-table-column label="所属部门">
|
||||
<template slot-scope="scope">{{ scope.row.user.dept_name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="header-center" label="职务/岗位">
|
||||
<template slot-scope="scope">{{ scope.row.user.position }}</template>
|
||||
<el-table-column label="身份证号">
|
||||
<template slot-scope="scope">{{ scope.row.ID_number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="最高学历">
|
||||
<template slot-scope="scope">{{ scope.row.max_edu }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建日期">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.create_time }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="260px">
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
|
@ -101,6 +118,7 @@
|
|||
</template>
|
||||
<script>
|
||||
import { getEmployeeList, deleteEmployee } from "@/api/employee"
|
||||
import { getOrgList } from "@/api/org"
|
||||
import { getDictList } from "@/api/dict"
|
||||
import Pagination from "@/components/Pagination"
|
||||
import checkPermission from '@/utils/permission'
|
||||
|
@ -117,12 +135,12 @@ export default {
|
|||
page: 1,
|
||||
page_size: 20
|
||||
},
|
||||
typeOptions: [],
|
||||
deptOptions: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getTypeOptions()
|
||||
this.getdeptOptions()
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
|
@ -135,9 +153,9 @@ export default {
|
|||
this.listLoading = false
|
||||
});
|
||||
},
|
||||
getTypeOptions() {
|
||||
getDictList({type__code:'cert_field'}).then(res=>{
|
||||
this.typeOptions = genTree(res.data)
|
||||
getdeptOptions() {
|
||||
getOrgList().then(res=>{
|
||||
this.deptOptions = genTree(res.data)
|
||||
})
|
||||
},
|
||||
resetFilter() {
|
||||
|
|
|
@ -1,29 +1,66 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
<div>基础信息</div>
|
||||
<el-form label-width="60px">
|
||||
<el-form-item label="姓名">{{formData.user.name}}</el-form-item>
|
||||
<el-form-item label="账户">{{formData.user.username}}</el-form-item>
|
||||
<el-form-item label="部门">{{formData.user.dept_name}}</el-form-item>
|
||||
<el-form-item label="角色">
|
||||
<el-tag
|
||||
v-for="(item, index) in formData.user.roles_name"
|
||||
:key="index"
|
||||
style="margin:2px"
|
||||
>{{item}}</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机">{{formData.user.phone}}</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :span="20">
|
||||
<div>详细信息</div>
|
||||
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="编号" prop="code">
|
||||
<el-input v-model="formData.code" placeholder="请输入编号" clearable :style="{width: '100%'}"></el-input>
|
||||
<el-input
|
||||
v-model="formData.code"
|
||||
placeholder="请输入编号"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="易记码" prop="remember_code">
|
||||
<el-input v-model="formData.remember_code" placeholder="请输入易记码" clearable :style="{width: '100%'}">
|
||||
</el-input>
|
||||
<el-input
|
||||
v-model="formData.remember_code"
|
||||
placeholder="请输入易记码"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="财务编号" prop="finance_number">
|
||||
<el-input v-model="formData.finance_number" placeholder="请输入财务编号" clearable :style="{width: '100%'}">
|
||||
</el-input>
|
||||
<el-input
|
||||
v-model="formData.finance_number"
|
||||
placeholder="请输入财务编号"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="性别" prop="gender">
|
||||
<el-select v-model="formData.gender" placeholder="请选择性别" clearable :style="{width: '100%'}" >
|
||||
<el-select
|
||||
v-model="formData.gender"
|
||||
placeholder="请选择性别"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in genderOptions"
|
||||
:key="item.key"
|
||||
|
@ -35,21 +72,34 @@
|
|||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="座机号" prop="landline">
|
||||
<el-input v-model="formData.landline" placeholder="请输入座机" clearable :style="{width: '100%'}">
|
||||
</el-input>
|
||||
<el-input
|
||||
v-model="formData.landline"
|
||||
placeholder="请输入座机"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model="formData.email" placeholder="请输入邮箱" clearable :style="{width: '100%'}">
|
||||
</el-input>
|
||||
<el-input
|
||||
v-model="formData.email"
|
||||
placeholder="请输入邮箱"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="职称" prop="gender">
|
||||
<el-select v-model="formData.pro_title" placeholder="请选择职称" clearable :style="{width: '100%'}" >
|
||||
<el-select
|
||||
v-model="formData.pro_title"
|
||||
placeholder="请选择职称"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in titleOptions"
|
||||
:key="item.key"
|
||||
|
@ -61,8 +111,12 @@
|
|||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="身份证号" prop="ID_number">
|
||||
<el-input v-model="formData.ID_number" placeholder="请输入身份证号" clearable :style="{width: '100%'}">
|
||||
</el-input>
|
||||
<el-input
|
||||
v-model="formData.ID_number"
|
||||
placeholder="请输入身份证号"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
|
@ -72,15 +126,20 @@
|
|||
v-model="formData.birth"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
placeholder="选择日期"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="劳务费级别" prop="gender">
|
||||
<el-select v-model="formData.fee_level" placeholder="请选择劳务费级别" clearable :style="{width: '100%'}" >
|
||||
<el-select
|
||||
v-model="formData.fee_level"
|
||||
placeholder="请选择劳务费级别"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in feeOptions"
|
||||
:key="item.key"
|
||||
|
@ -93,7 +152,8 @@
|
|||
<el-col :span="8">
|
||||
<el-form-item label="省市区" prop="region">
|
||||
<el-cascader
|
||||
clearable :style="{width: '100%'}"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
v-model="formData.region"
|
||||
:options="regionOptions"
|
||||
></el-cascader>
|
||||
|
@ -103,7 +163,12 @@
|
|||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="详细地址" prop="address">
|
||||
<el-input v-model="formData.address" placeholder="请输入详细地址" clearable :style="{width: '100%'}"></el-input>
|
||||
<el-input
|
||||
v-model="formData.address"
|
||||
placeholder="请输入详细地址"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -127,21 +192,26 @@
|
|||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="证件照" prop="photo">
|
||||
<el-upload :action="upUrl" accept=".png,.jpeg,.jpg"
|
||||
:headers="upHeaders" class="avatar-uploader" :show-file-list="false" :on-success="handleSuccess"
|
||||
:before-upload="beforeUpload">
|
||||
<img v-if="formData.photo" :src="formData.photo" class="avatar">
|
||||
<el-upload
|
||||
:action="upUrl"
|
||||
accept=".png, .jpeg, .jpg"
|
||||
:headers="upHeaders"
|
||||
class="avatar-uploader"
|
||||
:show-file-list="false"
|
||||
:on-success="handleSuccess"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<img v-if="formData.photo" :src="formData.photo" class="avatar" />
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
|
||||
</el-upload>
|
||||
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="签名图片" prop="signature">
|
||||
<el-upload :action="upUrl"
|
||||
:headers="upHeaders"></el-upload>
|
||||
|
||||
<el-upload :action="upUrl" :headers="upHeaders" accept=".png, .jpeg, .jpg" :before-upload="beforeUpload" class="avatar-uploader"
|
||||
:show-file-list="false"
|
||||
:on-success="handleSuccess2"><img v-if="formData.signature" :src="formData.signature" class="avatar2" />
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon2"></i></el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -150,6 +220,8 @@
|
|||
<el-button @click="goBack">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
<style>
|
||||
|
@ -161,36 +233,51 @@
|
|||
overflow: hidden;
|
||||
}
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409EFF;
|
||||
border-color: #409eff;
|
||||
}
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 100px;
|
||||
height: 126px;
|
||||
line-height: 126px;
|
||||
width: 110px;
|
||||
height: 140px;
|
||||
line-height: 140px;
|
||||
text-align: center;
|
||||
}
|
||||
.avatar {
|
||||
width: 100px;
|
||||
height: 126px;
|
||||
width: 110px;
|
||||
height: 140px;
|
||||
display: block;
|
||||
}
|
||||
.avatar-uploader-icon2 {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 150px;
|
||||
height: 90px;
|
||||
line-height: 90px;
|
||||
text-align: center;
|
||||
}
|
||||
.avatar2 {
|
||||
width: 150px;
|
||||
height: 90px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import { upUrl, upHeaders } from "@/api/file"
|
||||
import { getDictList } from "@/api/dict"
|
||||
import { genTree } from "@/utils"
|
||||
import { getEmployee, updateEmployee } from '@/api/employee'
|
||||
import { upUrl, upHeaders } from "@/api/file";
|
||||
import { genSignature } from "@/api/util"
|
||||
import { getUser } from "@/api/user";
|
||||
import { getDictList } from "@/api/dict";
|
||||
import { genTree } from "@/utils";
|
||||
import { getEmployee, updateEmployee } from "@/api/employee";
|
||||
const defaultForm = {
|
||||
is_onjob: true,
|
||||
is_fulltime: true,
|
||||
is_payinsurance: true
|
||||
}
|
||||
};
|
||||
export default {
|
||||
name:'Employeedetail',
|
||||
name: "Employeedetail",
|
||||
components: {},
|
||||
props: ['id'],
|
||||
props: ["id"],
|
||||
data() {
|
||||
return {
|
||||
upHeaders: upHeaders(),
|
||||
|
@ -200,83 +287,93 @@ export default {
|
|||
regionOptions: [],
|
||||
feeOptions: [],
|
||||
genderOptions: [
|
||||
{'value':'男','label':'男'},
|
||||
{'value':'女','label':'女'}
|
||||
{ value: "男", label: "男" },
|
||||
{ value: "女", label: "女" }
|
||||
],
|
||||
rules: {
|
||||
email: [
|
||||
{
|
||||
pattern: /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
|
||||
message: '邮箱格式错误',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
message: "邮箱格式错误",
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
ID_number: [
|
||||
{
|
||||
pattern: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/,
|
||||
message: '身份证格式错误',
|
||||
trigger: 'blur'
|
||||
}]
|
||||
message: "身份证格式错误",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.formData.id = this.id
|
||||
this.getDetail()
|
||||
this.getTitleOptions()
|
||||
this.getReginOptions()
|
||||
this.getFeeOptions()
|
||||
this.formData.id = this.id;
|
||||
this.getDetail();
|
||||
this.getTitleOptions();
|
||||
this.getReginOptions();
|
||||
this.getFeeOptions();
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
getDetail() {
|
||||
getEmployee(this.id).then(res => {
|
||||
this.formData = res.data
|
||||
})
|
||||
this.formData = res.data;
|
||||
});
|
||||
},
|
||||
beforeUpload(file) {
|
||||
const isLt1M = file.size / 1024 / 1024 < 1;
|
||||
if (!isLt1M) {
|
||||
this.$message.error('上传头像图片大小不能超过 1MB!');
|
||||
this.$message.error("上传头像图片大小不能超过 1MB!");
|
||||
}
|
||||
return isLt1M;
|
||||
},
|
||||
handleSuccess(res, file) {
|
||||
this.formData.photo = res.data.path;
|
||||
},
|
||||
handleSuccess2(res, file) {
|
||||
const loading = this.$loading({text:'上传成功,正在转换..'})
|
||||
genSignature({path:res.data.path}).then(res=>{
|
||||
this.formData.signature = res.data.path
|
||||
loading.close()
|
||||
}).catch(error=>{loading.close()})
|
||||
// this.formData.photo = res.data.path;
|
||||
},
|
||||
getTitleOptions() {
|
||||
getDictList({type__code:'pro_title'}).then(res=>{
|
||||
this.titleOptions=genTree(res.data)
|
||||
})
|
||||
getDictList({ type__code: "pro_title" }).then(res => {
|
||||
this.titleOptions = genTree(res.data);
|
||||
});
|
||||
},
|
||||
getFeeOptions() {
|
||||
getDictList({type__code:'fee_level'}).then(res=>{
|
||||
this.feeOptions = genTree(res.data)
|
||||
})
|
||||
getDictList({ type__code: "fee_level" }).then(res => {
|
||||
this.feeOptions = genTree(res.data);
|
||||
});
|
||||
},
|
||||
getReginOptions() {
|
||||
getDictList({type__code:'china_regions'}).then(res=>{
|
||||
this.regionOptions=genTree(res.data)
|
||||
})
|
||||
getDictList({ type__code: "china_regions" }).then(res => {
|
||||
this.regionOptions = genTree(res.data);
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['elForm'].validate(valid => {
|
||||
if (!valid) return
|
||||
this.$refs["elForm"].validate(valid => {
|
||||
if (!valid) return;
|
||||
// TODO 提交表单
|
||||
var data = this.formData
|
||||
data.region = data.region[data.region.length-1]
|
||||
var data = this.formData;
|
||||
data.region = data.region[data.region.length - 1];
|
||||
updateEmployee(this.id, data).then(res => {
|
||||
this.$message.success('成功')
|
||||
})
|
||||
})
|
||||
this.$message.success("成功");
|
||||
});
|
||||
});
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs['elForm'].resetFields()
|
||||
this.$refs["elForm"].resetFields();
|
||||
},
|
||||
goBack() {
|
||||
this.$router.go(-1)
|
||||
}
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -1,13 +1,29 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div style="display:flex">
|
||||
<treeselect v-model="listQuery.cert_field" :multiple="false" :options="typeOptions" :disable-branch-nodes="true" placeholder="认证领域" @input="handleFilter" style="width: 260px" clearable/>
|
||||
<el-select
|
||||
v-model="listQuery.auditor_type"
|
||||
placeholder="资格类型"
|
||||
clearable
|
||||
class="filter-item"
|
||||
@change="handleFilter"
|
||||
style="margin-left:10px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in auditor_typeOptions"
|
||||
:key="item.key"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-select
|
||||
v-model="listQuery.is_enabled"
|
||||
placeholder="是否有效"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
@change="handleFilter"
|
||||
style="margin-left:10px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in enableOptions"
|
||||
|
@ -16,11 +32,10 @@
|
|||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<treeselect v-model="listQuery.cert_field" :multiple="false" :options="typeOptions" :disable-branch-nodes="true" placeholder="认证领域" @input="handleFilter" style="width: 260px" clearable/>
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="证书/资格"
|
||||
style="width: 300px;"
|
||||
placeholder="证书号"
|
||||
style="width: 300px;margin-left:10px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
|
@ -29,6 +44,7 @@
|
|||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleFilter"
|
||||
style="margin-left:10px"
|
||||
>搜索</el-button>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
|
@ -40,7 +56,6 @@
|
|||
</div>
|
||||
<div style="margin-top:6px">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate">新增</el-button>
|
||||
</el-switch>
|
||||
</div>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
|
@ -129,14 +144,13 @@ export default {
|
|||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
is_enabled:true
|
||||
},
|
||||
typeOptions: [],
|
||||
enableOptions:[
|
||||
{label:'全部',value:''},
|
||||
{label:'有效',value:true},
|
||||
{label:'失效',value:false}
|
||||
],
|
||||
auditor_typeOptions:[],
|
||||
formData:{},
|
||||
dgType:'create',
|
||||
dgVisiable:false
|
||||
|
@ -146,6 +160,7 @@ export default {
|
|||
this.listQuery.employee = this.employee
|
||||
this.getList();
|
||||
this.getTypeOptions()
|
||||
this.getauditor_typeOptions()
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
|
@ -163,11 +178,15 @@ export default {
|
|||
this.typeOptions = genTree(res.data)
|
||||
})
|
||||
},
|
||||
getauditor_typeOptions() {
|
||||
getDictList({type__code:'auditor_qualification_type'}).then(res=>{
|
||||
this.auditor_typeOptions = genTree(res.data)
|
||||
})
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
is_enabled:true,
|
||||
employee: this.employee
|
||||
}
|
||||
this.getList()
|
||||
|
|
|
@ -0,0 +1,221 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div style="display:flex">
|
||||
<treeselect v-model="listQuery.cert_field" :multiple="false" :options="typeOptions" :disable-branch-nodes="true" placeholder="认证领域" @input="handleFilter" style="width: 260px" clearable/>
|
||||
<el-select
|
||||
v-model="listQuery.auditor_type"
|
||||
placeholder="资格类型"
|
||||
clearable
|
||||
class="filter-item"
|
||||
@change="handleFilter"
|
||||
style="margin-left:10px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in auditor_typeOptions"
|
||||
:key="item.key"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-select
|
||||
v-model="listQuery.is_enabled"
|
||||
placeholder="是否有效"
|
||||
clearable
|
||||
class="filter-item"
|
||||
@change="handleFilter"
|
||||
style="margin-left:10px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in enableOptions"
|
||||
:key="item.key"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="证书号"
|
||||
style="width: 300px;margin-left:10px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleFilter"
|
||||
style="margin-left:10px"
|
||||
>搜索</el-button>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
style="margin-left: 10px;"
|
||||
type="primary"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="resetFilter"
|
||||
>刷新重置</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="tableData.results"
|
||||
style="width: 100%;margin-top:10px;"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
max-height="500"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="认证领域">
|
||||
<template slot-scope="scope" v-if="scope.row.cert_field_">{{ scope.row.cert_field_.fullname }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="证书号">
|
||||
<template slot-scope="scope">{{ scope.row.cert_number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="资格类型">
|
||||
<template slot-scope="scope">{{ scope.row.auditor_type_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="注册日期">
|
||||
<template slot-scope="scope">{{ scope.row.registration_date }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="到期日期">
|
||||
<template slot-scope="scope">{{ scope.row.expiration_date }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否暂停">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="danger" v-if="scope.row.is_paused">是</el-tag>
|
||||
<el-tag type="success" v-else>否</el-tag></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否有效">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" v-if="scope.row.is_enabled">有效</el-tag>
|
||||
<el-tag type="danger" v-else>失效</el-tag></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="260px">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
:disabled="!checkPermission(['qualification_update'])"
|
||||
@click="handleUpdate(scope)"
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
:disabled="!checkPermission(['qualification_delete'])"
|
||||
@click="handleDelete(scope)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="tableData.count>0"
|
||||
:total="tableData.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<el-dialog :title="dgType=='create'?'新增':'编辑'" :visible.sync="dgVisiable" :close-on-click-modal="false" >
|
||||
<Qualificationform ref="Qualificationform" :formData="formData" :action="dgType" @close="closeDg" ></Qualificationform>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import { getQualificationList, createQualification, updateQualification, deleteQualification} from "@/api/qualification"
|
||||
import Qualificationform from "@/views/qualification/qualificationform"
|
||||
import { getDictList } from "@/api/dict"
|
||||
import Pagination from "@/components/Pagination"
|
||||
import checkPermission from '@/utils/permission'
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import { genTree } from '../../utils'
|
||||
export default {
|
||||
name:'Qualification',
|
||||
props:['employee'],
|
||||
components: { Pagination, Treeselect, Qualificationform },
|
||||
data() {
|
||||
return {
|
||||
tableData: {count:0},
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
typeOptions: [],
|
||||
enableOptions:[
|
||||
{label:'有效',value:true},
|
||||
{label:'失效',value:false}
|
||||
],
|
||||
auditor_typeOptions:[],
|
||||
formData:{},
|
||||
dgType:'create',
|
||||
dgVisiable:false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.listQuery.employee = this.employee
|
||||
this.getList();
|
||||
this.getTypeOptions()
|
||||
this.getauditor_typeOptions()
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getQualificationList(this.listQuery).then(response => {
|
||||
if (response.data) {
|
||||
this.tableData = response.data
|
||||
}
|
||||
this.listLoading = false
|
||||
});
|
||||
},
|
||||
getTypeOptions() {
|
||||
getDictList({type__code:'cert_field'}).then(res=>{
|
||||
this.typeOptions = genTree(res.data)
|
||||
})
|
||||
},
|
||||
getauditor_typeOptions() {
|
||||
getDictList({type__code:'auditor_qualification_type'}).then(res=>{
|
||||
this.auditor_typeOptions = genTree(res.data)
|
||||
})
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
employee: this.employee
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1
|
||||
this.getList()
|
||||
},
|
||||
handleCreate() {
|
||||
this.formData = Object.assign({}, {employee:this.employee, is_paused:false, is_enabled:true})
|
||||
this.dgType = 'create'
|
||||
this.dgVisiable = true
|
||||
// this.$refs.Qualificationform.formData = this.formData
|
||||
// this.$refs.Qualificationform.action = this.dgType
|
||||
},
|
||||
handleUpdate(scope) {
|
||||
this.formData = Object.assign({}, scope.row)
|
||||
this.dgType = 'update'
|
||||
this.dgVisiable = true
|
||||
},
|
||||
handleDelete(scope) {
|
||||
deleteQualification(scope.row.id).then(res=>{
|
||||
this.$message.success('成功')
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
closeDg(val) {
|
||||
if(val){
|
||||
this.getList()
|
||||
}
|
||||
this.dgVisiable=false
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,32 @@
|
|||
# Generated by Django 3.0.7 on 2020-07-16 10:06
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('certset', '0009_auto_20200709_1522'),
|
||||
('system', '0024_auto_20200716_0927'),
|
||||
('employee', '0012_auto_20200716_1200'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='ability',
|
||||
options={'verbose_name': '专业能力', 'verbose_name_plural': ('专业能力',)},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='employee',
|
||||
name='education',
|
||||
field=models.TextField(blank=True, verbose_name='最高学历'),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='ability',
|
||||
unique_together={('employee', 'major', 'major_rule')},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='qualification',
|
||||
unique_together=set(),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.7 on 2020-07-17 00:32
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('employee', '0013_auto_20200716_1806'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='employee',
|
||||
old_name='education',
|
||||
new_name='max_edu',
|
||||
),
|
||||
]
|
|
@ -2,6 +2,7 @@ from django.db import models
|
|||
from apps.system.models import CommonAModel, Dict, User, CommonBModel
|
||||
from apps.certset.models import ImplementRule
|
||||
from simple_history.models import HistoricalRecords
|
||||
from rest_framework.exceptions import ParseError
|
||||
|
||||
# Create your models here.
|
||||
|
||||
|
@ -39,6 +40,7 @@ class Employee(CommonAModel):
|
|||
blank=True, verbose_name='省市区', related_name='userdetail_region')
|
||||
address = models.TextField('详细地址', null=True, blank=True)
|
||||
signature = models.CharField('签名图片', max_length=200, null=True, blank=True)
|
||||
max_edu = models.TextField('最高学历', blank=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = '人员详细信息'
|
||||
|
@ -68,11 +70,26 @@ class Qualification(CommonAModel):
|
|||
class Meta:
|
||||
verbose_name = '注册资格'
|
||||
verbose_name_plural = verbose_name
|
||||
unique_together = ('employee', 'cert_field', 'is_enabled')
|
||||
|
||||
def __str__(self):
|
||||
return self.cert_number
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
"""
|
||||
暂停和启用该资格,需要操作能力表
|
||||
"""
|
||||
bool_ = Qualification.objects.filter(employee=self.employee, cert_field=self.cert_field, is_enabled=True, is_deleted=False).exclude(pk=self.id).exists()
|
||||
if bool_:
|
||||
raise ParseError('已存在该领域的有效注册资格')
|
||||
else:
|
||||
if not self.is_enabled:
|
||||
for i in Ability.objects.filter(employee=self.employee, cert_field=self.cert_field):
|
||||
i.auditor_abilitys.remove(Dict.objects.get(code='checker_auditor'))
|
||||
else:
|
||||
for i in Ability.objects.filter(employee=self.employee, cert_field=self.cert_field):
|
||||
i.auditor_abilitys.add(Dict.objects.get(code='checker_auditor'))
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
class Ability(CommonAModel):
|
||||
"""
|
||||
|
@ -95,7 +112,8 @@ class Ability(CommonAModel):
|
|||
|
||||
class Meta:
|
||||
verbose_name = '专业能力'
|
||||
verbose_name_plural = verbose_name
|
||||
verbose_name_plural = verbose_name,
|
||||
unique_together = ('employee', 'major', 'major_rule')
|
||||
|
||||
def __str__(self):
|
||||
s = ''
|
||||
|
@ -105,6 +123,12 @@ class Ability(CommonAModel):
|
|||
s = s + self.major_rule.code
|
||||
return s
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if self.cert_field and self.cert_field.code == 'CCC':
|
||||
self.major = None
|
||||
else:
|
||||
self.major_rule = None
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
class Education(CommonAModel):
|
||||
"""
|
||||
|
@ -126,6 +150,14 @@ class Education(CommonAModel):
|
|||
def __str__(self):
|
||||
return self.school
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
super().save(*args, **kwargs)
|
||||
queryset = Education.objects.filter(employee=self.employee,is_deleted=False).order_by('level')
|
||||
if queryset.exists():
|
||||
max_edu = queryset[0].level.name + '-' + queryset[0].school
|
||||
self.employee.max_edu = max_edu
|
||||
self.employee.save()
|
||||
|
||||
|
||||
class Train(CommonAModel):
|
||||
"""
|
||||
|
|
|
@ -9,24 +9,20 @@ class EmployeeSerializer(serializers.ModelSerializer):
|
|||
"""
|
||||
普通序列化
|
||||
"""
|
||||
user = UserListSerializer()
|
||||
user = UserListSerializer(read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = Employee
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def setup_eager_loading(queryset):
|
||||
""" Perform necessary eager loading of data. """
|
||||
queryset = queryset.select_related('user')
|
||||
return queryset
|
||||
|
||||
class EmployeeUpdateSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
update序列化
|
||||
"""
|
||||
class Meta:
|
||||
model = Employee
|
||||
exclude = ['user']
|
||||
|
||||
class QualificationSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
|
@ -67,22 +63,6 @@ class AbilitySerializer(serializers.ModelSerializer):
|
|||
queryset = queryset.prefetch_related('auditor_abilitys',)
|
||||
return queryset
|
||||
|
||||
|
||||
def save(self, **kwargs):
|
||||
validated_data = dict(
|
||||
list(self.validated_data.items()) +
|
||||
list(kwargs.items())
|
||||
)
|
||||
if validated_data['cert_field'] and validated_data['cert_field'].code == 'CCC':
|
||||
validated_data['major'] = None
|
||||
else:
|
||||
validated_data['major_rule'] = None
|
||||
if self.instance is not None:
|
||||
self.instance = self.update(self.instance, validated_data)
|
||||
else:
|
||||
self.instance = self.create(validated_data)
|
||||
return self.instance
|
||||
|
||||
class EducationSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
普通序列化
|
||||
|
@ -92,6 +72,7 @@ class EducationSerializer(serializers.ModelSerializer):
|
|||
model = Education
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
class TrainSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
普通序列化
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
from django.shortcuts import render
|
||||
from rest_framework.viewsets import ModelViewSet
|
||||
from rest_framework.response import Response
|
||||
from rest_framework import status
|
||||
from .models import *
|
||||
from .serializers import *
|
||||
from apps.system.permission_data import RbacFilterSet
|
||||
|
@ -14,14 +16,9 @@ class EmployeeViewSet(CreateUpdateCustomMixin, OptimizationMixin, ModelViewSet):
|
|||
queryset = Employee.objects.all()
|
||||
serializer_class = EmployeeSerializer
|
||||
search_fields = ['code', 'remember_code', 'user__name']
|
||||
filterset_fields = ['is_onjob', 'is_fulltime']
|
||||
filterset_fields = ['is_onjob', 'is_fulltime', 'user__dept']
|
||||
ordering = ['-create_time']
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.action == 'update':
|
||||
return EmployeeUpdateSerializer
|
||||
else:
|
||||
return self.serializer_class
|
||||
|
||||
class QualificationViewSet(CreateUpdateCustomMixin, OptimizationMixin, ModelViewSet):
|
||||
"""
|
||||
|
@ -44,7 +41,7 @@ class AbilityViewSet(CreateUpdateCustomMixin, OptimizationMixin, ModelViewSet):
|
|||
queryset = Ability.objects.all()
|
||||
serializer_class = AbilitySerializer
|
||||
search_fields = ['major__code', 'major_rule__code']
|
||||
filterset_fields = ['major', 'major_rule', 'auditor_abilitys']
|
||||
filterset_fields = ['major', 'major_rule', 'auditor_abilitys', 'afrom']
|
||||
ordering = ['-create_time']
|
||||
|
||||
class EducationViewSet(CreateUpdateCustomMixin, OptimizationMixin, ModelViewSet):
|
||||
|
@ -57,7 +54,7 @@ class EducationViewSet(CreateUpdateCustomMixin, OptimizationMixin, ModelViewSet)
|
|||
serializer_class = EducationSerializer
|
||||
search_fields = ['school', 'major', 'employee__name']
|
||||
filterset_fields = ['level']
|
||||
ordering = ['-create_time']
|
||||
ordering = ['level__sort']
|
||||
|
||||
class TrainViewSet(CreateUpdateCustomMixin, OptimizationMixin, ModelViewSet):
|
||||
"""
|
||||
|
|
|
@ -84,11 +84,11 @@ class UserListSerializer(serializers.ModelSerializer):
|
|||
用户列表序列化
|
||||
"""
|
||||
dept_name = serializers.StringRelatedField(source='dept')
|
||||
|
||||
roles_name = serializers.StringRelatedField(source='roles', many=True)
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ['id', 'name', 'phone', 'email', 'position',
|
||||
'username', 'is_active', 'date_joined', 'dept_name', 'dept', 'roles', 'avatar']
|
||||
'username', 'is_active', 'date_joined', 'dept_name', 'dept', 'roles', 'avatar', 'roles_name']
|
||||
|
||||
@staticmethod
|
||||
def setup_eager_loading(queryset):
|
||||
|
|
|
@ -21,7 +21,7 @@ from rest_framework import routers
|
|||
from rest_framework.documentation import include_docs_urls
|
||||
from rest_framework_simplejwt.views import (TokenObtainPairView,
|
||||
TokenRefreshView)
|
||||
|
||||
from utils.view import GenSignature
|
||||
from apps.system.views import FileViewSet, LogoutView
|
||||
router = routers.DefaultRouter()
|
||||
router.register('file', FileViewSet, basename="file")
|
||||
|
@ -36,6 +36,7 @@ urlpatterns = [
|
|||
path('employee/', include('apps.employee.urls')),
|
||||
path('docs/', include_docs_urls(title="接口文档",
|
||||
authentication_classes=[], permission_classes=[])),
|
||||
path('signature/', GenSignature.as_view(), name='gen_signature'),
|
||||
path('', include(router.urls)),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
|
||||
|
|
|
@ -4,11 +4,12 @@ from rest_framework.parsers import MultiPartParser
|
|||
from rest_framework.permissions import IsAuthenticated
|
||||
from PIL import Image
|
||||
from django.conf import settings
|
||||
|
||||
from rest_framework import status
|
||||
from datetime import datetime
|
||||
import os
|
||||
import uuid
|
||||
|
||||
import cv2
|
||||
from server.settings import BASE_DIR
|
||||
|
||||
# class UploadFileView(APIView):
|
||||
# permission_classes = [IsAuthenticated]
|
||||
|
@ -28,3 +29,22 @@ import uuid
|
|||
# f.write(chunk)
|
||||
# resdata = {"name": file_name, "path": '/' + file_path}
|
||||
# return Response(resdata)
|
||||
|
||||
class GenSignature(APIView):
|
||||
"""
|
||||
生成签名图片
|
||||
"""
|
||||
permission_classes=[]
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
path = (BASE_DIR + request.data['path']).replace('\\', '/')
|
||||
image = cv2.imread(path, cv2.IMREAD_UNCHANGED)
|
||||
size = image.shape
|
||||
for i in range(size[0]):
|
||||
for j in range(size[1]):
|
||||
if image[i][j][0]>100 and image[i][j][1]>100 and image[i][j][2]>100:
|
||||
image[i][j][3] = 0
|
||||
else:
|
||||
image[i][j][0],image[i][j][1],image[i][j][2] = 0,0,0
|
||||
cv2.imwrite(path,image)
|
||||
return Response(request.data, status=status.HTTP_200_OK)
|
||||
|
|
Loading…
Reference in New Issue