4 changed files with 412 additions and 1 deletions
@ -0,0 +1,194 @@ |
|||
<template> |
|||
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false" customClass="customWidth"> |
|||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"> |
|||
<el-form-item label="部门名称" prop="deptId" label-width="120px"> |
|||
<el-cascader |
|||
ref="name" |
|||
v-model="dataForm.joinDeptIdsArr" |
|||
:options="options" |
|||
:props="{ multiple: false, emitPath: false, checkStrictly: true }" |
|||
@visible-change="changeHandle" |
|||
style="width:90%;" |
|||
:disabled="dataForm.id?true:false" |
|||
> |
|||
</el-cascader> |
|||
</el-form-item> |
|||
<el-form-item label="考核年份" prop="year" label-width="120px"> |
|||
<el-date-picker v-model="dataForm.year" :disabled="dataForm.id?true:false" |
|||
type="year" clearable placeholder="选择年" |
|||
value-format="yyyy" format="yyyy" style="width:45%;"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
<el-form-item label="民生评价打分" prop="peopleEvaluate" label-width="120px"> |
|||
<el-input-number v-model="dataForm.peopleEvaluate" :min="0" :max="10" label="民生评价打分" :precision="1" style="width:45%;"></el-input-number> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template slot="footer"> |
|||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|||
<el-button type="primary" :disabled="isAble" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import debounce from 'lodash/debounce' |
|||
export default { |
|||
data () { |
|||
return { |
|||
visible: false, |
|||
dataForm: { |
|||
id: '', |
|||
deptId: '', |
|||
deptName: '', |
|||
deptTypeKey: '', |
|||
year: '', |
|||
peopleEvaluate: '', |
|||
parentDeptIds: '', |
|||
parentDeptNames: '', |
|||
allDeptIds: '', |
|||
allDeptNames: '', |
|||
revision: '', |
|||
createdBy: '', |
|||
createdTime: '', |
|||
updatedBy: '', |
|||
updatedTime: '', |
|||
delFlag: '', |
|||
joinDeptIdsArr: '' |
|||
}, |
|||
options: [], |
|||
isAble: false |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
deptId: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
deptName: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
deptTypeKey: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
year: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
peopleEvaluate: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
joinDeptIdsArr: [ |
|||
{ required: false, message: this.$t('validate.required'), trigger: 'blur' } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
created: function () { |
|||
this.dataForm.joinDeptIdsArr = '' |
|||
this.dataForm.deptId = '' |
|||
this.getOptions() |
|||
}, |
|||
methods: { |
|||
init () { |
|||
this.visible = true |
|||
this.isAble = false |
|||
this.$nextTick(() => { |
|||
this.$refs['dataForm'].resetFields() |
|||
if (this.dataForm.id) { |
|||
this.getInfo() |
|||
} else { |
|||
this.dataForm.joinDeptIdsArr = '' |
|||
this.dataForm.deptId = '' |
|||
} |
|||
}) |
|||
}, |
|||
getOptions () { |
|||
this.$http |
|||
.get(`/sys/user/deptOptions/getAllDeptPartyByUser`) |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.options = res.data.options |
|||
}) |
|||
.catch(() => {}) |
|||
}, |
|||
changeHandle (value, selectedData) { |
|||
let parentDeptIds = '' |
|||
let parentDeptNames = '' |
|||
let allDeptIds = '' |
|||
let allDeptNames = '' |
|||
let deptId = '' |
|||
let deptName = '' |
|||
if (this.$refs['name'].getCheckedNodes() !== null && this.$refs['name'].getCheckedNodes().length > 0) { |
|||
var path = this.$refs['name'].getCheckedNodes()[0].path |
|||
var pathLabels = this.$refs['name'].getCheckedNodes()[0].pathLabels |
|||
for (var i = 0; i < path.length; i++) { |
|||
if (i < path.length - 1) { |
|||
parentDeptIds += path[i] + ',' |
|||
} else { |
|||
deptId = path[i] |
|||
} |
|||
allDeptIds += path[i] + ',' |
|||
} |
|||
for (var j = 0; j < pathLabels.length; j++) { |
|||
if (j < pathLabels.length - 1) { |
|||
parentDeptNames += pathLabels[j] + '-' |
|||
} else { |
|||
deptName = pathLabels[j] |
|||
} |
|||
allDeptNames += pathLabels[j] + '-' |
|||
} |
|||
} |
|||
this.dataForm.parentDeptIds = parentDeptIds.length > 0 ? parentDeptIds.substring(0, parentDeptIds.length - 1) : parentDeptIds |
|||
this.dataForm.parentDeptNames = parentDeptNames.length > 0 ? parentDeptNames.substring(0, parentDeptNames.length - 1) : parentDeptNames |
|||
this.dataForm.allDeptIds = allDeptIds.length > 0 ? allDeptIds.substring(0, allDeptIds.length - 1) : allDeptIds |
|||
this.dataForm.allDeptNames = allDeptNames.length > 0 ? allDeptNames.substring(0, allDeptNames.length - 1) : allDeptNames |
|||
this.dataForm.deptId = deptId |
|||
this.dataForm.deptName = deptName |
|||
}, |
|||
// 获取信息 |
|||
getInfo () { |
|||
this.$http.get(`/kpi/kpipeopleevaluate/${this.dataForm.id}`).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.dataForm = { |
|||
...this.dataForm, |
|||
...res.data |
|||
} |
|||
this.dataForm.joinDeptIdsArr = this.dataForm.deptId |
|||
}).catch(() => {}) |
|||
}, |
|||
// 表单提交 |
|||
dataFormSubmitHandle: debounce(function () { |
|||
this.$refs['dataForm'].validate((valid) => { |
|||
if (!valid) { |
|||
return false |
|||
} |
|||
this.isAble = true |
|||
this.$http[!this.dataForm.id ? 'post' : 'put']('/kpi/kpipeopleevaluate/', this.dataForm).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
this.isAble = false |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.visible = false |
|||
this.$emit('refreshDataList') |
|||
} |
|||
}) |
|||
}).catch(() => {}) |
|||
}) |
|||
}, 1000, { 'leading': true, 'trailing': false }) |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss"> |
|||
.customWidth { |
|||
width:35% |
|||
} |
|||
</style> |
|||
@ -0,0 +1,216 @@ |
|||
<template> |
|||
<el-card shadow="never" class="aui-card--fill"> |
|||
<div class="mod-kpi__kpipeopleevaluate}"> |
|||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataListSearch()"> |
|||
<el-form-item> |
|||
<el-form-item label="部门" label-width="68px"> |
|||
<el-cascader |
|||
v-model="deptIdList" |
|||
:options="options" |
|||
:props="{ checkStrictly: true }" |
|||
filterable |
|||
clearable |
|||
></el-cascader> |
|||
</el-form-item> |
|||
</el-form-item> |
|||
<el-form-item label="考核年月"> |
|||
<el-date-picker v-model="dataForm.year" |
|||
type="year" clearable placeholder="选择年" |
|||
value-format="yyyy" format="yyyy"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
<br/> |
|||
<el-form-item label="部门类型" prop="deptTypeKey"> |
|||
<el-select v-model="dataForm.deptTypeKey" placeholder="部门类型" clearable> |
|||
<el-option v-for="item in paramNameArr" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" ></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="success" @click="getDataListSearch()">{{ $t('query') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="success" @click="exportTemplate()">导出录入模板</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-upload class="upload-demo" |
|||
ref="upload" |
|||
v-loading="dataListLoading" |
|||
:action="uploadUrl" |
|||
:limit="1" |
|||
:on-success='uploadSuccess' |
|||
:on-error='errorExceed' |
|||
accept=".xls,.xlsx"> |
|||
<el-button type="primary">导入打分结果</el-button> |
|||
</el-upload> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button v-if="$hasPermission('kpi:kpipeopleevaluate:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;"> |
|||
<el-table-column label="序号" header-align="center" align="center" width="50px"> |
|||
<template slot-scope="scope"> |
|||
{{scope.$index+1}} |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="deptName" label="部门名称" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="deptTypeKey" label="部门类型" header-align="center" align="center" :formatter = "stateFormat"></el-table-column> |
|||
<el-table-column prop="year" label="年份" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="peopleEvaluate" label="民生评价打分" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="parentDeptNames" label="上级部门" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="allDeptNames" label="所有部门" header-align="center" align="center"></el-table-column> |
|||
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150"> |
|||
<template slot-scope="scope"> |
|||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
|||
<el-button v-if="$hasPermission('kpi:kpipeopleevaluate:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<el-pagination |
|||
:current-page="page" |
|||
:page-sizes="[10, 20, 50, 100]" |
|||
:page-size="limit" |
|||
:total="total" |
|||
layout="total, sizes, prev, pager, next, jumper" |
|||
@size-change="pageSizeChangeHandle" |
|||
@current-change="pageCurrentChangeHandle"> |
|||
</el-pagination> |
|||
<!-- 弹窗, 新增 / 修改 --> |
|||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
|||
</div> |
|||
</el-card> |
|||
</template> |
|||
|
|||
<script> |
|||
import mixinViewModule from '@/mixins/view-module' |
|||
import AddOrUpdate from './kpipeopleevaluate-add-or-update' |
|||
import Cookies from 'js-cookie' |
|||
import qs from 'qs' |
|||
export default { |
|||
mixins: [mixinViewModule], |
|||
data () { |
|||
return { |
|||
mixinViewModuleOptions: { |
|||
getDataListURL: '/kpi/kpipeopleevaluate/page', |
|||
getDataListIsPage: true, |
|||
deleteURL: '/kpi/kpipeopleevaluate', |
|||
deleteIsBatch: true, |
|||
exportTemplateURL: '/kpi/kpipeopleevaluate/exportTemplate' |
|||
}, |
|||
dataForm: { |
|||
id: '', |
|||
deptTypeKey: '', |
|||
year: '', |
|||
deptId: '' |
|||
}, |
|||
// 所属机构配置 |
|||
deptIdList: [], |
|||
options: [], |
|||
paramNameArr: [] |
|||
} |
|||
}, |
|||
components: { |
|||
AddOrUpdate |
|||
}, |
|||
watch: { |
|||
'deptIdList': function (val) { |
|||
if (val.length === 0) { |
|||
this.dataForm.deptId = '' |
|||
} else if (val.length > 0) { |
|||
this.dataForm.deptId = this.deptIdList[val.length - 1] |
|||
} |
|||
} |
|||
}, |
|||
created: function () { |
|||
this.getOptions() |
|||
this.getParamListInfo('dept_type') |
|||
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/kpi/kpipeopleevaluate/importManualScoreExcel?token=${Cookies.get('token')}` |
|||
}, |
|||
methods: { |
|||
stateFormat (row, column) { |
|||
for (var i = 0; i < this.paramNameArr.length; i++) { |
|||
if (row.deptTypeKey === this.paramNameArr[i].dictValue) { |
|||
return this.paramNameArr[i].dictName |
|||
} |
|||
} |
|||
}, |
|||
getOptions () { |
|||
this.$http |
|||
.get(`/sys/user/deptOptions/getAllDeptPartyByUser`) |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.options = res.data.options |
|||
}) |
|||
.catch(() => {}) |
|||
}, |
|||
// 获取参数名称code下拉信息 |
|||
getParamListInfo (dictType) { |
|||
this.$http.get(`/sys/dict/listSimple/` + dictType).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
if (dictType === 'dept_type') { |
|||
this.paramNameArr = res.data |
|||
} |
|||
}).catch(() => {}) |
|||
}, |
|||
exportTemplate () { |
|||
let remindInfo = '' |
|||
let year = this.dataForm.year |
|||
let deptTypeKey = this.dataForm.deptTypeKey |
|||
let deptId = this.dataForm.deptId |
|||
if (!deptId) { |
|||
remindInfo += '部门、' |
|||
} |
|||
if (!year) { |
|||
remindInfo += '考核周期起始年、' |
|||
} |
|||
if (!deptTypeKey) { |
|||
remindInfo += '部门类型、' |
|||
} |
|||
if (remindInfo.length > 0) { |
|||
remindInfo = remindInfo.substring(0, remindInfo.length - 1) |
|||
return this.$message.error(remindInfo + '不能为空!') |
|||
} |
|||
let params = qs.stringify({ |
|||
'token': Cookies.get('token'), |
|||
'year': year, |
|||
'deptTypeKey': deptTypeKey, |
|||
'deptId': deptId |
|||
}) |
|||
window.location.href = `${window.SITE_CONFIG['apiURL']}${this.mixinViewModuleOptions.exportTemplateURL}?${params}` |
|||
}, |
|||
errorExceed (file, fileList) { |
|||
this.$message.error('上传失败请重试') |
|||
}, |
|||
uploadSuccess (response, file, fileList) { |
|||
this.dataListLoading = false |
|||
this.$refs.upload.clearFiles() |
|||
if (response.code !== 0 || (response.data !== null && response.data.length > 0)) { |
|||
this.errordataList = response.data |
|||
if (this.errordataList != null && this.errordataList.length > 0) { |
|||
this.faultDataVisible = true |
|||
} else { |
|||
this.$message.error(response.msg) |
|||
} |
|||
return |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.deptIdList = '' |
|||
this.dataForm.deptId = '' |
|||
this.getDataList() |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
Loading…
Reference in new issue