|
|
@ -1,49 +1,42 @@ |
|
|
|
<template> |
|
|
|
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false"> |
|
|
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"> |
|
|
|
<el-form-item label="父资源ID" prop="pid"> |
|
|
|
<el-input v-model="dataForm.pid" placeholder="父资源ID"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="考核类型" prop="checkType"> |
|
|
|
<el-input v-model="dataForm.checkType" placeholder="考核类型"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="考核编码" prop="checkCode"> |
|
|
|
<el-input v-model="dataForm.checkCode" placeholder="考核编码"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="考核标签" prop="checkLabel"> |
|
|
|
<el-input v-model="dataForm.checkLabel" placeholder="考核标签"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="显示标识:0否,1是" prop="showFlag"> |
|
|
|
<el-input v-model="dataForm.showFlag" placeholder="显示标识:0否,1是"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="描述" prop="checkDescribe"> |
|
|
|
<el-input v-model="dataForm.checkDescribe" placeholder="描述"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="排序" prop="sort"> |
|
|
|
<el-input v-model="dataForm.sort" placeholder="排序"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="逻辑删除标识" prop="delFlag"> |
|
|
|
<el-input v-model="dataForm.delFlag" placeholder="逻辑删除标识"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="乐观锁" prop="revision"> |
|
|
|
<el-input v-model="dataForm.revision" placeholder="乐观锁"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="创建人" prop="createdBy"> |
|
|
|
<el-input v-model="dataForm.createdBy" placeholder="创建人"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="创建时间" prop="createdTime"> |
|
|
|
<el-input v-model="dataForm.createdTime" placeholder="创建时间"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="更新人" prop="updatedBy"> |
|
|
|
<el-input v-model="dataForm.updatedBy" placeholder="更新人"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="更新时间" prop="updatedTime"> |
|
|
|
<el-input v-model="dataForm.updatedTime" placeholder="更新时间"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="考核项名称" prop="checkLabel" label-width="100px"> |
|
|
|
<el-input v-model="dataForm.checkLabel" placeholder="考核项名称" maxlength="128"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="考核类型" prop="checkType" label-width="100px"> |
|
|
|
<el-input v-model="dataForm.checkType" placeholder="考核类型" maxlength="32"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="考核编码" prop="checkCode" label-width="100px"> |
|
|
|
<el-input v-model="dataForm.checkCode" placeholder="考核编码" maxlength="32"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="parentName" :label="$t('menu.parentName')" class="menu-list" label-width="100px"> |
|
|
|
<el-popover v-model="resourceListVisible" ref="resourceListPopover" placement="bottom-start" trigger="click"> |
|
|
|
<el-tree :data="resourceList" :props="{ label: 'checkLabel', children: 'children' }" node-key="id" |
|
|
|
ref="resourceListTree" :highlight-current="true" :expand-on-click-node="false" accordion |
|
|
|
@current-change="resourceListTreeCurrentChangeHandle"> |
|
|
|
</el-tree> |
|
|
|
</el-popover> |
|
|
|
<el-input v-model="dataForm.parentName" v-popover:resourceListPopover :readonly="true" placeholder="上级资源"> |
|
|
|
<i v-if="dataForm.pid !== '0'" slot="suffix" @click.stop="deptListTreeSetDefaultHandle()" class="el-icon-circle-close el-input__icon"></i> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="排序" prop="sort" label-width="100px"> |
|
|
|
<el-input-number v-model="dataForm.sort" controls-position="right" :min="0" label="排序"></el-input-number> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="描述" prop="checkDescribe" label-width="100px"> |
|
|
|
<el-input v-model="dataForm.checkDescribe" placeholder="描述" maxlength="1024"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="showFlag" label="是否显示" size="mini" label-width="100px"> |
|
|
|
<el-radio-group v-model="dataForm.showFlag"> |
|
|
|
<el-radio label="0">否</el-radio> |
|
|
|
<el-radio label="1">是</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<template slot="footer"> |
|
|
|
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|
|
|
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|
|
|
<el-button type="primary" @click="dataFormSubmitHandle()" :disabled="isAble">{{ $t('confirm') }}</el-button> |
|
|
|
</template> |
|
|
|
</el-dialog> |
|
|
|
</template> |
|
|
@ -57,19 +50,17 @@ export default { |
|
|
|
dataForm: { |
|
|
|
id: '', |
|
|
|
pid: '', |
|
|
|
parentName: '', |
|
|
|
checkType: '', |
|
|
|
checkCode: '', |
|
|
|
checkLabel: '', |
|
|
|
showFlag: '', |
|
|
|
showFlag: '1', |
|
|
|
checkDescribe: '', |
|
|
|
sort: '', |
|
|
|
delFlag: '', |
|
|
|
revision: '', |
|
|
|
createdBy: '', |
|
|
|
createdTime: '', |
|
|
|
updatedBy: '', |
|
|
|
updatedTime: '' |
|
|
|
} |
|
|
|
sort: '0' |
|
|
|
}, |
|
|
|
resourceListVisible: false, |
|
|
|
resourceList: [], |
|
|
|
isAble: false |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
@ -90,29 +81,8 @@ export default { |
|
|
|
showFlag: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
checkDescribe: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
sort: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
delFlag: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
revision: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
createdBy: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
createdTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
updatedBy: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
updatedTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
@ -120,16 +90,33 @@ export default { |
|
|
|
methods: { |
|
|
|
init () { |
|
|
|
this.visible = true |
|
|
|
this.isAble = false |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs['dataForm'].resetFields() |
|
|
|
if (this.dataForm.id) { |
|
|
|
this.getInfo() |
|
|
|
} |
|
|
|
this.dataForm.parentName = '一级资源' |
|
|
|
this.dataForm.pid = '0' |
|
|
|
this.dataForm.resourceList = [] |
|
|
|
this.getResourceList().then(() => { |
|
|
|
if (this.dataForm.id) { |
|
|
|
this.getInfo() |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取菜单列表 |
|
|
|
getResourceList () { |
|
|
|
return this.$http.get('/kpi/subcheckdictionary/list') |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.resourceList = res.data |
|
|
|
}) |
|
|
|
.catch(() => {}) |
|
|
|
}, |
|
|
|
// 获取信息 |
|
|
|
getInfo () { |
|
|
|
this.$http.get(`/news/subcheckdictionary/${this.dataForm.id}`).then(({ data: res }) => { |
|
|
|
this.$http.get(`/kpi/subcheckdictionary/${this.dataForm.id}`).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
@ -137,16 +124,34 @@ export default { |
|
|
|
...this.dataForm, |
|
|
|
...res.data |
|
|
|
} |
|
|
|
if (this.dataForm.pid === '0' || this.dataForm.pid === 0) { |
|
|
|
return this.deptListTreeSetDefaultHandle() |
|
|
|
} |
|
|
|
this.$refs.resourceListTree.setCurrentKey(this.dataForm.pid) |
|
|
|
this.dataForm.parentName = this.$refs.resourceListTree.getCurrentNode().checkLabel |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
// 上级菜单树, 设置默认值 |
|
|
|
deptListTreeSetDefaultHandle () { |
|
|
|
this.dataForm.pid = '0' |
|
|
|
this.dataForm.parentName = '一级资源' |
|
|
|
}, |
|
|
|
// 上级菜单树, 选中 |
|
|
|
resourceListTreeCurrentChangeHandle (data) { |
|
|
|
this.dataForm.pid = data.id |
|
|
|
this.dataForm.parentName = data.checkLabel |
|
|
|
this.resourceListVisible = false |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
|
dataFormSubmitHandle: debounce(function () { |
|
|
|
this.$refs['dataForm'].validate((valid) => { |
|
|
|
if (!valid) { |
|
|
|
return false |
|
|
|
} |
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/news/subcheckdictionary/', this.dataForm).then(({ data: res }) => { |
|
|
|
this.isAble = true |
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/kpi/subcheckdictionary/', this.dataForm).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
this.isAble = false |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.$message({ |
|
|
@ -164,3 +169,69 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style lang="scss"> |
|
|
|
.mod-sys__menu { |
|
|
|
.resource-list { |
|
|
|
.el-select .el-input__inner { |
|
|
|
min-width: 110px; |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
} |
|
|
|
.menu-list, |
|
|
|
.icon-list { |
|
|
|
.el-input__inner, |
|
|
|
.el-input__suffix { |
|
|
|
cursor: pointer; |
|
|
|
} |
|
|
|
} |
|
|
|
&-icon-popover { |
|
|
|
width: 458px; |
|
|
|
overflow: hidden; |
|
|
|
} |
|
|
|
&-icon-inner { |
|
|
|
width: 478px; |
|
|
|
max-height: 258px; |
|
|
|
overflow-x: hidden; |
|
|
|
overflow-y: auto; |
|
|
|
} |
|
|
|
&-icon-list { |
|
|
|
width: 458px; |
|
|
|
padding: 0; |
|
|
|
margin: -8px 0 0 -8px; |
|
|
|
> .el-button { |
|
|
|
padding: 8px; |
|
|
|
margin: 8px 0 0 8px; |
|
|
|
> span { |
|
|
|
display: inline-block; |
|
|
|
vertical-align: middle; |
|
|
|
width: 18px; |
|
|
|
height: 18px; |
|
|
|
font-size: 18px; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.avatar-uploader .el-upload { |
|
|
|
border: 1px dashed #d9d9d9; |
|
|
|
border-radius: 6px; |
|
|
|
cursor: pointer; |
|
|
|
position: relative; |
|
|
|
overflow: hidden; |
|
|
|
} |
|
|
|
.avatar-uploader .el-upload:hover { |
|
|
|
border-color: #409eff; |
|
|
|
} |
|
|
|
.avatar-uploader-icon { |
|
|
|
font-size: 28px; |
|
|
|
color: #8c939d; |
|
|
|
width: 378px; |
|
|
|
height: 178px; |
|
|
|
line-height: 178px; |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
.avatar { |
|
|
|
width: 300px; |
|
|
|
height: 178px; |
|
|
|
display: block; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|