<template>
|
<div class="app-container">
|
<!--工具栏-->
|
<div class="head-container">
|
<div v-if="crud.props.searchToggle">
|
<!-- 搜索 -->
|
<label class="el-form-item-label">公司</label>
|
<el-select v-model="query.companyId" filterable clearable placeholder="公司" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
|
<el-option
|
v-for="item in companys"
|
:key="item.id"
|
:label="item.label"
|
:value="item.id"
|
/>
|
</el-select>
|
<rrOperation :crud="crud" />
|
</div>
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<crudOperation :permission="permission">
|
<el-button
|
slot="right"
|
v-permission="permission.synchronous"
|
class="filter-item"
|
size="mini"
|
type="primary"
|
icon="el-icon-refresh"
|
style="margin-right: 6px;"
|
:loading="loading"
|
:disabled="crud.selections.length === 0"
|
@click="synchronous(crud.selections)"
|
>同步</el-button>
|
</crudOperation>
|
<!--表单组件-->
|
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
|
<el-form ref="form" :model="form" :inline="true" :rules="rules" size="small" label-width="80px">
|
<el-form-item label="公司" prop="company.id">
|
<el-select v-model="form.company.id" filterable clearable placeholder="请选择" style="width: 370px;">
|
<el-option
|
v-for="item in companys"
|
:key="item.id"
|
:label="item.label"
|
:value="item.id"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-divider>公积金</el-divider>
|
<el-form-item label="基数" prop="accumulationFund">
|
<el-input v-model="form.accumulationFund" style="width: 370px;" />
|
</el-form-item>
|
<el-form-item label="个人比例" prop="accumulationFundPersonal">
|
<el-input v-model="form.accumulationFundPersonal" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="公司比例" prop="accumulationFundCompany">
|
<el-input v-model="form.accumulationFundCompany" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
<el-divider>养老险</el-divider>
|
<el-form-item label="基数" prop="retirementInsurance">
|
<el-input v-model="form.retirementInsurance" style="width: 370px;" />
|
</el-form-item>
|
<el-form-item label="个人比例" prop="retirementInsurancePersonal">
|
<el-input v-model="form.retirementInsurancePersonal" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="公司比例" prop="retirementInsuranceCompany">
|
<el-input v-model="form.retirementInsuranceCompany" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
<el-divider>医疗险</el-divider>
|
<el-form-item label="基数" prop="medicalInsurance">
|
<el-input v-model="form.medicalInsurance" style="width: 370px;" />
|
</el-form-item>
|
<el-form-item label="个人比例" prop="medicalInsurancePersonal">
|
<el-input v-model="form.medicalInsurancePersonal" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="公司比例" prop="medicalInsuranceCompany">
|
<el-input v-model="form.medicalInsuranceCompany" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
<el-divider>失业险</el-divider>
|
<el-form-item label="基数" prop="unemploymentInsurance">
|
<el-input v-model="form.unemploymentInsurance" style="width: 370px;" />
|
</el-form-item>
|
<el-form-item label="个人比例" prop="unemploymentInsurancePersonal">
|
<el-input v-model="form.unemploymentInsurancePersonal" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="公司比例" prop="unemploymentInsuranceCompany">
|
<el-input v-model="form.unemploymentInsuranceCompany" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
<el-divider>生育险</el-divider>
|
<el-form-item label="基数" prop="birthInsurance">
|
<el-input v-model="form.birthInsurance" style="width: 370px;" />
|
</el-form-item>
|
<el-form-item label="个人比例" prop="birthInsurancePersonal">
|
<el-input v-model="form.birthInsurancePersonal" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="公司比例" prop="birthInsuranceCompany">
|
<el-input v-model="form.birthInsuranceCompany" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
<el-divider>工伤险</el-divider>
|
<el-form-item label="基数" prop="employmentInsurance">
|
<el-input v-model="form.employmentInsurance" style="width: 370px;" />
|
</el-form-item>
|
<el-form-item label="个人比例" prop="employmentInsurancePersonal">
|
<el-input v-model="form.employmentInsurancePersonal" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="公司比例" prop="employmentInsuranceCompany">
|
<el-input v-model="form.employmentInsuranceCompany" style="width: 130px;">
|
<template slot="append">%</template>
|
</el-input>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
</div>
|
</el-dialog>
|
<!--表格渲染-->
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
<el-table-column type="selection" width="55" />
|
<el-table-column prop="companyId" label="公司" width="150">
|
<template slot-scope="scope">
|
<el-tag>{{ scope.row.company.label }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="accumulationFund" label="公积金基数" />
|
<el-table-column prop="accumulationFundPersonal" label="公积金个人比例">
|
<template slot-scope="scope">
|
{{ scope.row.accumulationFundPersonal }}%
|
</template>
|
</el-table-column>
|
<el-table-column prop="accumulationFundCompany" label="公积金公司比例">
|
<template slot-scope="scope">
|
{{ scope.row.accumulationFundCompany }}%
|
</template>
|
</el-table-column>
|
<el-table-column prop="retirementInsurance" label="养老险基数" />
|
<el-table-column prop="retirementInsurancePersonal" label="公积金个人比例">
|
<template slot-scope="scope">
|
{{ scope.row.retirementInsurancePersonal }}%
|
</template>
|
</el-table-column>
|
<el-table-column prop="retirementInsuranceCompany" label="公积金公司比例">
|
<template slot-scope="scope">
|
{{ scope.row.retirementInsuranceCompany }}%
|
</template>
|
</el-table-column>
|
<el-table-column prop="medicalInsurance" label="医疗险基数" />
|
<el-table-column prop="medicalInsurancePersonal" label="医疗险个人比例">
|
<template slot-scope="scope">
|
{{ scope.row.medicalInsurancePersonal }}%
|
</template>
|
</el-table-column>
|
<el-table-column prop="medicalInsuranceCompany" label="医疗险公司比例">
|
<template slot-scope="scope">
|
{{ scope.row.medicalInsuranceCompany }}%
|
</template>
|
</el-table-column>
|
<el-table-column prop="unemploymentInsurance" label="失业险基数" />
|
<el-table-column prop="unemploymentInsurancePersonal" label="失业险个人比例">
|
<template slot-scope="scope">
|
{{ scope.row.unemploymentInsurancePersonal }}%
|
</template>
|
</el-table-column>
|
<el-table-column prop="unemploymentInsuranceCompany" label="失业险公司比例">
|
<template slot-scope="scope">
|
{{ scope.row.unemploymentInsuranceCompany }}%
|
</template>
|
</el-table-column>
|
<el-table-column prop="birthInsurance" label="生育险基数" />
|
<el-table-column prop="birthInsurancePersonal" label="生育险个人比例">
|
<template slot-scope="scope">
|
{{ scope.row.birthInsurancePersonal }}%
|
</template>
|
</el-table-column>
|
<el-table-column prop="birthInsuranceCompany" label="生育险公司比例">
|
<template slot-scope="scope">
|
{{ scope.row.birthInsuranceCompany }}%
|
</template>
|
</el-table-column>
|
<el-table-column prop="employmentInsurance" label="工伤险基数" />
|
<el-table-column prop="employmentInsurancePersonal" label="工伤险个人比例">
|
<template slot-scope="scope">
|
{{ scope.row.employmentInsurancePersonal }}%
|
</template>
|
</el-table-column>
|
<el-table-column prop="employmentInsuranceCompany" label="工伤险公司比例">
|
<template slot-scope="scope">
|
{{ scope.row.employmentInsuranceCompany }}%
|
</template>
|
</el-table-column>
|
<el-table-column v-if="checkPer(['admin','cmnInsurance:edit','cmnInsurance:del'])" label="操作" width="150px" align="center">
|
<template slot-scope="scope">
|
<udOperation
|
:data="scope.row"
|
:permission="permission"
|
/>
|
</template>
|
</el-table-column>
|
</el-table>
|
<!--分页组件-->
|
<pagination />
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import crudCmnInsurance from '@/api/treatment/cmnInsurance'
|
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
import rrOperation from '@crud/RR.operation'
|
import crudOperation from '@crud/CRUD.operation'
|
import udOperation from '@crud/UD.operation'
|
import pagination from '@crud/Pagination'
|
import crudSysCompany from '@/api/system/sysCompany'
|
|
const defaultForm = { id: null, company: { id: null }, accumulationFund: null, accumulationFundPersonal: null, accumulationFundCompany: null, retirementInsurance: null, retirementInsurancePersonal: null, retirementInsuranceCompany: null, medicalInsurance: null, medicalInsurancePersonal: null, medicalInsuranceCompany: null, unemploymentInsurance: null, unemploymentInsurancePersonal: null, unemploymentInsuranceCompany: null, birthInsurance: null, birthInsurancePersonal: null, birthInsuranceCompany: null, employmentInsurance: null, employmentInsurancePersonal: null, employmentInsuranceCompany: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
|
export default {
|
name: 'CmnInsurance',
|
components: { pagination, crudOperation, rrOperation, udOperation },
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
cruds() {
|
return CRUD({ title: '五险一金', url: 'api/cmnInsurance', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCmnInsurance }})
|
},
|
data() {
|
return {
|
permission: {
|
add: ['admin', 'cmnInsurance:add'],
|
edit: ['admin', 'cmnInsurance:edit'],
|
del: ['admin', 'cmnInsurance:del'],
|
download: ['admin', 'cmnInsurance:list'],
|
synchronous: ['admin', 'cmnInsurance:synchronous']
|
},
|
rules: {
|
'company.id': [
|
{ required: true, message: '公司不能为空', trigger: 'blur' }
|
],
|
accumulationFund: [
|
{ required: true, message: '公积金基数不能为空', trigger: 'blur' }
|
],
|
accumulationFundPersonal: [
|
{ required: true, message: '公积金个人比例不能为空', trigger: 'blur' }
|
],
|
accumulationFundCompany: [
|
{ required: true, message: '公积金公司比例不能为空', trigger: 'blur' }
|
],
|
retirementInsurance: [
|
{ required: true, message: '养老险基数不能为空', trigger: 'blur' }
|
],
|
retirementInsurancePersonal: [
|
{ required: true, message: '公积金个人比例不能为空', trigger: 'blur' }
|
],
|
retirementInsuranceCompany: [
|
{ required: true, message: '公积金公司比例不能为空', trigger: 'blur' }
|
],
|
medicalInsurance: [
|
{ required: true, message: '医疗险基数不能为空', trigger: 'blur' }
|
],
|
medicalInsurancePersonal: [
|
{ required: true, message: '医疗险个人比例不能为空', trigger: 'blur' }
|
],
|
medicalInsuranceCompany: [
|
{ required: true, message: '医疗险公司比例不能为空', trigger: 'blur' }
|
],
|
unemploymentInsurance: [
|
{ required: true, message: '失业险基数不能为空', trigger: 'blur' }
|
],
|
unemploymentInsurancePersonal: [
|
{ required: true, message: '失业险个人比例不能为空', trigger: 'blur' }
|
],
|
unemploymentInsuranceCompany: [
|
{ required: true, message: '失业险公司比例不能为空', trigger: 'blur' }
|
],
|
birthInsurance: [
|
{ required: true, message: '生育险基数不能为空', trigger: 'blur' }
|
],
|
birthInsurancePersonal: [
|
{ required: true, message: '生育险个人比例不能为空', trigger: 'blur' }
|
],
|
birthInsuranceCompany: [
|
{ required: true, message: '生育险公司比例不能为空', trigger: 'blur' }
|
],
|
employmentInsurance: [
|
{ required: true, message: '工伤险基数不能为空', trigger: 'blur' }
|
],
|
employmentInsurancePersonal: [
|
{ required: true, message: '工伤险个人比例不能为空', trigger: 'blur' }
|
],
|
employmentInsuranceCompany: [
|
{ required: true, message: '工伤险公司比例不能为空', trigger: 'blur' }
|
]
|
},
|
queryTypeOptions: [
|
{ key: 'companyId', display_name: '公司' }
|
],
|
// 公司
|
companys: [],
|
loading: false
|
}
|
},
|
methods: {
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
[CRUD.HOOK.beforeRefresh]() {
|
this.getAllCompany()
|
return true
|
},
|
// 获取所有公司
|
getAllCompany() {
|
crudSysCompany.getAll().then(res => {
|
this.companys = res
|
})
|
},
|
// 修改同步按钮
|
synchronous(data) {
|
this.$confirm(
|
'此操作将同步 ' + data.length + ' 条五险一金相关的数据, 是否继续?',
|
'提示',
|
{
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'success'
|
}
|
).then(() => {
|
this.loading = true
|
// ID列表
|
const ids = []
|
for (let i = 0; i < data.length; i++) {
|
// ID列表
|
ids.push(data[i].id)
|
}
|
crudCmnInsurance.synchronous(ids).then(res => {
|
// 消息提示
|
this.crud.notify('同步成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
this.loading = false
|
})
|
})
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|