指标库

1,添加/编辑指标
2,移动指标、
3,删除指标,
4,分类列表,编辑
5,搜索
This commit is contained in:
zhujida 2021-01-21 15:40:25 +08:00
parent aba6f3ec29
commit 2b30cfbfe8
8 changed files with 922 additions and 226 deletions

67
src/api/target.js Normal file
View File

@ -0,0 +1,67 @@
import request from '@/utils/request'
// 获取分类 类型列表
export function apiGetIndicatorType (query) {
return request({
url: '/lz_management/indicatorType/list',
method: 'post',
data: query
})
}
// 删除分类
export function apiGetIndicatorTypeDelete (query) {
return request({
url: '/lz_management/indicatorType/delete',
method: 'get',
params: query
})
}
// 添加 修改 分类
export function apiGetIndicatorTypeEdit (query) {
return request({
url: '/lz_management/indicatorType/saveOrUpdate',
method: 'post',
data: query
})
}
// 指标库- 获取分类统计
export function apiGetIndicatorLibraryStatistical (query) {
return request({
url: '/lz_management/indicatorLibrary/statistical',
method: 'get',
params: query
})
}
// 获取指标列表
export function apiGetIndicatorLibraryList (query) {
return request({
url: '/lz_management/indicatorLibrary/list',
method: 'post',
data: query
})
}
// 移动指标
export function apiGetIndicatorLibraryItemsMove (query) {
return request({
url: '/lz_management/indicatorLibrary/move',
method: 'post',
data: query
})
}
// 删除指标
export function apiGetIndicatorLibraryItemsDelete (query) {
return request({
url: '/lz_management/indicatorLibrary/delete',
method: 'get',
params: query
})
}
// 修改或新增指标
export function apiGetIndicatorLibraryEdit (query) {
return request({
url: '/lz_management/indicatorLibrary/saveOrUpdate',
method: 'post',
data: query
})
}

View File

@ -0,0 +1,120 @@
//
<template>
<div>
<popup-right
v-if="isShowPopup"
@cancel="hundlePopupHide"
@submit="handleSubmitPopup"
title="选择指标项"
subumitText="确定"
class="popup commonFont"
>
<div slot="content">
<div class="search-header">
<el-button
@click="handleFiltrate"
type="primary"
plain
size="small"
>筛选</el-button>
<el-input
@change="handleSearch"
v-model="searchInputValue"
placeholder="请输入内容"
prefix-icon="el-icon-search"
size="small"
clearable
></el-input>
</div>
<el-table
data="tableData"
selection-change="handleSelectionChange"
>
<el-table-column
label="全选"
prop="name"
></el-table-column>
<el-table-column
label=""
prop="quanzhong"
width="60px"
></el-table-column>
</el-table>
<div class="comonPromptFont filtrate-prompt">没有更多了</div>
<div
slot="footer-left"
style="color:@fontBlue;"
>已选择{{this.selectedList.length}}</div>
</div>
<div></div>
</popup-right>
<target-filtrate
:isShowTargetFiltrate.sync="isShowPopupFiltrate"
@cb="handelTargetFilter"
/>
</div>
</template>
<script>
import PopupRight from '@/components/PopupRight'
import TargetFiltrate from '@/components/TargetFiltrate'
export default {
methods: {
handleFiltrate () {
console.log('筛选-标签类别')
},
handleSearch (val) {
console.log('搜索-----')
console.log(val)
},
handleSelectionChange (val) {
//
this.selectedList = val
},
handelTargetFilter (list) {
//
this.isShowPopupFiltrate = true
console.log(list)
},
hundlePopupHide () {
this.$emit('update:isShowPopup', false)
},
handleSubmitPopup () {
this.$emit('cd', this.selectedList)
// this.$emit('update:isShowPopup', false)
}
},
data () {
return {
isShowPopupFiltrate: false,
searchInputValue: '',
tableData: [],
selectedList: []
}
},
components: {
PopupRight,
TargetFiltrate
},
props: {
isShowPopup: {
type: Boolean,
default: false
},
dataList: {
type: Array,
default: () => {
return [{ id: 1, name: '全部指标' }, { id: 2, name: '全部指标' }]
}
}
}
}
</script>
<style lang="less" scoped>
.popup {
.filtrate-prompt {
text-align: center;
padding: 15px;
}
}
</style>

View File

@ -24,13 +24,26 @@
</template>
<script>
import PopupRight from '@/components/PopupRight'
import { apiGetIndicatorType } from '@/api/target'
export default {
methods: {
hundlePopupHide () {
console.log('移动到---隐藏')
this.$emit('update:isShowPopupRadio', false)
},
handleSubmitPopup () {
console.log('提交---隐藏')
console.log(this.radioSelectedId)
this.$emit('cd', this.radioSelectedId)
this.$emit('update:isShowPopupRadio', false)
},
handleGetClasseList () {
apiGetIndicatorType({ type: 0 }).then(res => {
if (res.code === 200) {
this.tableData = res.data.list
}
})
}
},
components: {
@ -48,18 +61,19 @@ export default {
subumitText: {
default: '确定',
type: String
},
dataList: {
type: Array,
default: () => {
return [{ id: 1, name: '全部指标' }, { id: 2, name: '全部指标' }]
}
},
watch: {
isShowPopupRadio (now) {
if (now) {
this.handleGetClasseList()
}
}
},
data () {
return {
radioSelectedId: '',
tableData: this.dataList
tableData: []
}
}
}

View File

@ -21,9 +21,9 @@
:class="area.selectedId === item.id? area.btnSelected:area.btnDef"
v-for="item in area.list"
:key="item.id"
@click="area.selectedId = item.id"
@click="handleRadio(area,item)"
>
<span>爱福家拉法基拉法基酸辣粉司法局阿里</span>
<span>{{item.name}}</span>
</div>
</div>
</div>
@ -32,7 +32,7 @@
</template>
<script>
import PopupRight from '@/components/PopupRight'
import { apiGetIndicatorType } from '@/api/target'
export default {
methods: {
hundlePopupHide () {
@ -40,15 +40,34 @@ export default {
this.$emit('update:isShowTargetFiltrate', false)
},
handleSubmitPopup () {
let idList = this.listData.map(item => {
let key = item.id
let value = item.selectedId
let dic = {}
dic[key] = value
return dic
})
console.log(idList)
let val = this.areaSelectedDic ? this.areaSelectedDic : null
this.$emit('cd', val)
this.$emit('update:isShowTargetFiltrate', false)
},
handleRadio (area, val) {
//
console.log(val)
area.selectedId = val.id
this.areaSelectedDic = val.id === -1 ? null : val
},
handleGetTargetTypelist () {
//
let para = {
currPage: 1,
pageSize: 200,
type: 1
}
apiGetIndicatorType(para).then(res => {
if (res.code === 200) {
let data = res.data
this.$nextTick(() => {
this.listData[0].list = [{ id: -1, name: '全部' }].concat(data.list)
console.log(this.listData)
})
}
})
}
},
data () {
@ -63,23 +82,33 @@ export default {
listData: [
{
title: '类型',
id: 'area1',
selectedId: 1,
id: 'id',
selectedId: -1,
btnDef: 'area-content-item btn-def',
btnSelected: 'area-content-item btn-def btn-def-selected',
list: [{ id: 1, title: '全部' }, { id: 2, title: '量化指标' }, { id: 3, title: '行为价值观指标' }, { id: 4, title: '加分项' }, { id: 5, title: '扣分项' }]
},
{
title: '标签',
id: 'area2',
selectedId: 1,
btnDef: 'area-content-item btn-blue-def',
btnSelected: 'area-content-item btn-blue-def btn-blue-selected',
list: [{ id: 1, title: '全部' }, { id: 2, title: '量化指标' }, { id: 3, title: '行为价值观指标' }, { id: 4, title: '加分项' }, { id: 5, title: '扣分项' }]
list: []
}
// {
// title: '',
// id: 'area2',
// selectedId: 1,
// btnDef: 'area-content-item btn-blue-def',
// btnSelected: 'area-content-item btn-blue-def btn-blue-selected',
// list: [{ id: 1, title: '' }, { id: 2, title: '' }, { id: 3, title: '' }, { id: 4, title: '' }, { id: 5, title: '' }]
// }
],
areaSelectedDic: {}
areaSelectedDic: null
}
},
watch: {
isShowTargetFiltrate (now, old) {
console.log('old:' + old)
console.log('now:' + now)
if (now) {
this.handleGetTargetTypelist()
}
}
},
props: {

View File

@ -56,6 +56,7 @@ service.interceptors.response.use(res => {
}
if (res.data.code === 401) {
const resaa = Object.assign({}, res.data, {msg: '登陆失效,请刷新重试'})
Message.error('登陆失效,请刷新重试')
return resaa
}
return res.data

View File

@ -12,85 +12,120 @@
</div>
<div class="goals-content-tabbar">
<el-tabs :value="activeId">
<el-tab-pane v-for="(i,index) in obj.recortModelDtos"
:key="i.id"
:label="i.name + ' ( '+( i.maxCount===null?(handleNumber(i)):(handleNumber(i)+'/'+i.maxCount))+' ) '"
:name="String(i.id)">
<el-tab-pane
v-for="(i,index) in obj.recortModelDtos"
:key="i.id"
:label="i.name + ' ( '+( i.maxCount===null?(handleNumber(i)):(handleNumber(i)+'/'+i.maxCount))+' ) '"
:name="String(i.id)"
>
<div class="goals-content-tabbar-table">
<div class="goals-content-tabbar-table-header commonFont">
<span style="width:200px;">指标名称</span>
<span class="kaohe"
style="flex:1 0 auto;">考核标准</span>
<span
class="kaohe"
style="flex:1 0 auto;"
>考核标准</span>
<span style="width:100px;">权重</span>
<span style="width:240px;">操作</span>
</div>
<div style="justify-content:center;"
v-if="handleFilter(i.detailDtos).length===0"
class="zanwu goals-content-tabbar-table-content commonFont items">
<div
style="justify-content:center;"
v-if="handleFilter(i.detailDtos).length===0"
class="zanwu goals-content-tabbar-table-content commonFont items"
>
暂无指标
</div>
<draggable v-model="i.tagetLibItems"
:options='options1'>
<div class="goals-content-tabbar-table-content commonFont items"
v-for="(j,indexJ) in handleFilter(i.detailDtos)"
:key="indexJ">
<draggable
v-model="i.tagetLibItems"
:options='options1'
>
<div
class="goals-content-tabbar-table-content commonFont items"
v-for="(j,indexJ) in handleFilter(i.detailDtos)"
:key="indexJ"
>
<div class="goals-content-tabbar-table-content-top">
<div style="width:200px;"
class="my-handle pre"><img style="width:20px;height:20px;"
src="@/assets/img/yidong.png"
alt="">
<pre>{{j.target}}</pre>
</div>
<div style="flex:1 0 auto;"
class="kaohe">
<div
style="width:200px;"
class="my-handle pre"
><img
style="width:20px;height:20px;"
src="@/assets/img/yidong.png"
alt=""
>
<pre>{{j.target}}</pre>
</div>
<div
style="flex:1 0 auto;"
class="kaohe"
>
<pre>{{j.keyResult}}</pre>
</div>
<div style="width:100px;">{{ Math.round((j.checkWeight * 100)*1000)/1000}}%</div>
<div style="width:240px;">
<el-button @click="hanidleAddTask(j,0)"
type="primary" plain
size="mini">
<el-button
@click="hanidleAddTask(j,0)"
type="primary"
plain
size="mini"
>
添加任务
</el-button>
<el-button @click="hanidleEdit(j,indexJ,index)"
type="text"
size="small">
<el-button
@click="hanidleEdit(j,indexJ,index)"
type="text"
size="small"
>
编辑
</el-button>
<el-button style="color:#F56C6C;" @click="handleDelateWeidu(j,indexJ,index)"
type="text"
size="small">
<el-button
style="color:#F56C6C;"
@click="handleDelateWeidu(j,indexJ,index)"
type="text"
size="small"
>
删除
</el-button>
</div>
</div>
<div v-for="(kitem,indexK) in handleFilter(j.taskDtos)"
:key="indexK"
class="goals-content-tabbar-table-content-bottom">
<div
v-for="(kitem,indexK) in handleFilter(j.taskDtos)"
:key="indexK"
class="goals-content-tabbar-table-content-bottom"
>
<div>任务{{indexK+1}}{{kitem.name.length>16?kitem.name.substring(0,12):kitem.name}}(当前进度:{{Math.round((kitem.processRate * 100)*1000)/1000|| 0}}%)</div>
<div style="width:240px;padding: 0 0 0 20px;">
<el-button style="visibility:hidden;"
type="primary" plain
size="mini">
<el-button
style="visibility:hidden;"
type="primary"
plain
size="mini"
>
添加任务
</el-button>
<el-button type="text"
@click="hanidleAddTask(j,1,kitem)"
size="small">
<el-button
type="text"
@click="hanidleAddTask(j,1,kitem)"
size="small"
>
编辑
</el-button>
<el-button type="text"
style="color:#F56C6C;"
@click="handleDeleteTask(j,kitem)"
size="small">
<el-button
type="text"
style="color:#F56C6C;"
@click="handleDeleteTask(j,kitem)"
size="small"
>
删除
</el-button>
</div>
</div>
</div>
</draggable>
<div style=" padding: 10px;font-size:16px;"
class="commonFont">
<div
style=" padding: 10px;font-size:16px;"
class="commonFont"
>
<div>
业务指标权重{{handleGetWeight(i)}}% <span v-if="i.weight !== null">/{{Math.round((i.weight * 100)*1000)/1000}}%</span>
</div>
@ -99,98 +134,143 @@
</div>
</div>
<div style=" padding: 10px;">
<!-- <el-button size="mini" plain>选择指标项</el-button> -->
<el-button @click="hanidleEdit(i,-1,index)"
type="primary"
icon="el-icon-plus"
size="small"
plain>增加指标项</el-button>
<el-button
@click="handelChooseTarger(i,index)"
icon="el-icon-finished"
type="primary"
size="small"
plain
>选择指标项</el-button>
<el-button
@click="hanidleEdit(i,-1,index)"
type="primary"
icon="el-icon-plus"
size="small"
plain
>增加指标项</el-button>
</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
</div>
<popup-right v-if="showTask"
@cancel='handleCancelTask'
@submit="handleSubmitTask"
:title="taskTitle">
<div slot="content"
class="weiduManage">
<el-form label-position="left"
ref="formTask"
:model="formTask"
:rules="ruleIndicators"
label-width="180px">
<el-form-item prop="name"
label='任务名称'>
<el-input clearable
type="textarea"
:rows="2"
size="small"
placeholder="请输入任务名称"
v-model="formTask.name"></el-input>
<popup-right
v-if="showTask"
@cancel='handleCancelTask'
@submit="handleSubmitTask"
:title="taskTitle"
>
<div
slot="content"
class="weiduManage"
>
<el-form
label-position="left"
ref="formTask"
:model="formTask"
:rules="ruleIndicators"
label-width="180px"
>
<el-form-item
prop="name"
label='任务名称'
>
<el-input
clearable
type="textarea"
:rows="2"
size="small"
placeholder="请输入任务名称"
v-model="formTask.name"
></el-input>
</el-form-item>
<el-form-item label="任务进度"
prop="weight">
<el-input size="small"
@blur="$handleBlur('formTask.processRate')"
@input.native="$handleInputInt('formTask.processRate')"
v-model="formTask.processRate">
<el-form-item
label="任务进度"
prop="weight"
>
<el-input
size="small"
@blur="$handleBlur('formTask.processRate')"
@input.native="$handleInputInt('formTask.processRate')"
v-model="formTask.processRate"
>
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-form>
</div>
<el-button slot="footer"
@click="handleSubmitTask(1)"
size="small"
type="primary"
>确定并继续添加</el-button>
<el-button
slot="footer"
@click="handleSubmitTask(1)"
size="small"
type="primary"
>确定并继续添加</el-button>
</popup-right>
<popup-right v-if="showIndicators"
@cancel='handleCancelZhibiao'
@submit="handleSubmitZhibiao"
:title="zhibiaoTitle">
<div slot="content"
class="weiduManage">
<el-form label-position="left"
ref="formIndicators"
:model="formIndicators"
:rules="ruleIndicators"
label-width="180px">
<popup-right
v-if="showIndicators"
@cancel='handleCancelZhibiao'
@submit="handleSubmitZhibiao"
:title="zhibiaoTitle"
>
<div
slot="content"
class="weiduManage"
>
<el-form
label-position="left"
ref="formIndicators"
:model="formIndicators"
:rules="ruleIndicators"
label-width="180px"
>
<el-form-item label="指标类型">
<el-select v-model="formIndicators.type"
disabled
placeholder="请选择维度类型">
<el-option v-for="i in dimensionsList"
:key="i.id"
:label="i.name"
:value="i.id"></el-option>
<el-select
v-model="formIndicators.type"
disabled
placeholder="请选择维度类型"
>
<el-option
v-for="i in dimensionsList"
:key="i.id"
:label="i.name"
:value="i.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item prop="target"
label='指标名称'>
<el-input clearable
:rows="4"
type="textarea"
size="small"
v-model="formIndicators.target"></el-input>
<el-form-item
prop="target"
label='指标名称'
>
<el-input
clearable
:rows="4"
type="textarea"
size="small"
v-model="formIndicators.target"
></el-input>
</el-form-item>
<el-form-item label="考核标准"
prop="keyResult">
<el-input size="small"
clearable
:rows="22"
type="textarea"
v-model="formIndicators.keyResult"></el-input>
<el-form-item
label="考核标准"
prop="keyResult"
>
<el-input
size="small"
clearable
:rows="22"
type="textarea"
v-model="formIndicators.keyResult"
></el-input>
</el-form-item>
<el-form-item label="权重"
prop="weight">
<el-input size="small"
@blur="$handleBlur('formIndicators.checkWeight')"
@input.native="$handleInputInt('formIndicators.checkWeight')"
v-model="formIndicators.checkWeight">
<el-form-item
label="权重"
prop="weight"
>
<el-input
size="small"
@blur="$handleBlur('formIndicators.checkWeight')"
@input.native="$handleInputInt('formIndicators.checkWeight')"
v-model="formIndicators.checkWeight"
>
<template slot="append">%</template>
</el-input>
</el-form-item>
@ -199,18 +279,24 @@
</popup-right>
<div class="goals-bottom">
<div class="goals-bottom-content">
<el-button size='small'
v-if="this.$route.query.saveIn===1"
@click="handleSaveDetail(obj,1)"
plain>保存</el-button>
<el-button size='small'
v-if="this.$route.query.saveAndAdd===1"
@click="handleSaveDetail(obj,2)"
plain>暂存</el-button>
<el-button size='small'
type="primary"
v-if="this.$route.query.saveAndAdd===1"
@click="handleGetNext">提交</el-button>
<el-button
size='small'
v-if="this.$route.query.saveIn===1"
@click="handleSaveDetail(obj,1)"
plain
>保存</el-button>
<el-button
size='small'
v-if="this.$route.query.saveAndAdd===1"
@click="handleSaveDetail(obj,2)"
plain
>暂存</el-button>
<el-button
size='small'
type="primary"
v-if="this.$route.query.saveAndAdd===1"
@click="handleGetNext"
>提交</el-button>
</div>
</div>
</div>
@ -554,6 +640,12 @@ export default {
}
})
},
handelChooseTarger (item, index) {
//
console.log('选择指标项-------')
console.dir(item)
console.log(index)
},
//
hanidleEdit (item, index, type) {
if (item.maxCount !== null) {
@ -613,7 +705,8 @@ export default {
<style lang='less' scoped>
.goals {
span,div{
span,
div {
box-sizing: border-box;
}
.kaohe {
@ -697,7 +790,7 @@ export default {
&-content {
// align-items: center;
// height: 60px;
border-bottom: 1px solid @borderColor;
border-bottom: 1px solid @borderColor;
&-top {
border-bottom: 1px solid @borderColor;
display: flex;
@ -711,7 +804,7 @@ export default {
&-bottom {
font-size: 14px;
display: flex;
color:#999999;
color: #999999;
align-items: center;
justify-content: space-between;
margin: 0 0 0 50px;

View File

@ -1,61 +1,69 @@
/* eslint-disable semi-spacing */
<template>
<div class="add-target commonFont">
<el-form
ref="formTarget"
:model="formData"
size="small"
label-width="200px"
label-width="100px"
:rules="formRules"
label-position="left"
style="width: 600px;"
>
<el-form-item
label="指标分类:"
prop="classeName"
prop="indicatorType"
>
<el-select
v-model="formData.classeName"
v-model="formData.indicatorType"
placeholder="请选择指标分类"
>
<el-option
v-for="item in calsseDateList"
v-for="item in calsseDataList"
:key="item.id"
:label="item.label"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item prop="targetType">
<el-form-item prop="type">
<div
slot="label"
style="margin-left:10px;"
>指标类型</div>
<el-radio-group v-model="formData.targetType">
<el-radio
v-for="item in targetRadioList"
<el-select
v-model="formData.type"
placeholder="请选择指标分类"
>
<el-option
v-for="item in targetTypeList"
:key="item.id"
:label="item.id"
>{{item.label}}</el-radio>
</el-radio-group>
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
prop="name"
label="指标名称:"
prop="targetName"
>
<el-input
v-model="formData.targetName"
v-model="formData.name"
placeholder="请输入指标名称"
clearable
></el-input>
</el-form-item>
<el-form-item prop="standard">
<el-form-item prop="keyResult">
<div
slot="label"
style="margin-left:10px;"
>考核标准</div>
<el-input
type="textarea"
v-model="formData.standard"
v-model="formData.keyResult"
placeholder="请输入指标名称"
clearable
></el-input>
</el-form-item>
<el-form-item prop="weight">
@ -65,9 +73,11 @@
>权重</div>
<el-input
type="number"
v-model="formData.weight"
placeholder="请输入指标名称"
clearable
oninput="value=value.replace(/^\.+|[^\d.]/g,'')"
@change="handleWeightChange"
>
<el-button slot="append">%</el-button>
</el-input>
@ -85,28 +95,105 @@
</div>
</template>
<script>
import { apiGetIndicatorType, apiGetIndicatorLibraryEdit } from '@/api/target'
export default {
methods: {
handleWeightChange (val) {
if (val) {
if (val.length > 0) {
let weight = parseFloat(this.formData.weight)
this.formData.weight = weight
}
console.log(this.formData.weight)
// if (val.length > 0) {
// let weightTwo = weight.toFixed(2).toString()
// let arr = weightTwo.split('.')
// if (arr.length === 2) {
// /* eslint-disable */
// for (let index = weightTwo.length - 1;index < weightTwo.length;index--) {
// let sub = weightTwo.substring(index, 1)
// if (sub !== '0' && sub !== '.') {
// weightTwo = weightTwo.substring(0, index)
// break
// }
// }
// console.log(weightTwo)
// }
// }
}
},
handleSaveSet () {
//
this.$refs.formTarget.validate((valid) => {
if (valid) {
alert('submit!')
apiGetIndicatorLibraryEdit(this.formData).then(res => {
if (res.code === 200) {
this.$message.success(res.msg)
this.$router.go(-1)
}
})
} else {
console.log('error submit!!')
return false
}
})
},
handleGetIndicatorType (type = 0) {
let para = {
currPage: 1,
type: type,
pageSize: 40
}
apiGetIndicatorType(para).then(res => {
if (res.code === 200) {
let data = res.data
if (type === 0) {
//
this.calsseDataList = data.list
this.calsseDataList.push({ id: 0, name: '未分类指标' })
if (this.calsseDataList.length > 0 && this.changeTargetId === -1) {
let item = data.list[0]
this.formData.indicatorType = item.id
}
} else {
//
this.targetTypeList = data.list
if (this.targetTypeList.length > 0 && this.changeTargetId === -1) {
let item = data.list[0]
this.formData.type = item.id
}
}
} else {
if (type === 0) {
this.formData.indicatorType = 0
}
}
})
}
},
created () {
if (this.$route.query.id) {
console.log('this.$route.query:')
console.log(this.$route.query)
this.changeTargetId = this.$route.query.id
this.formData = this.$route.query
}
//
this.handleGetIndicatorType(0)
this.handleGetIndicatorType(1)
},
data () {
return {
formData: { classeName: 1, targetType: 0, targetName: '', standard: '', weight: '' },
changeTargetId: -1, // id
// indicatorType: 0, type: 0, name: '', keyResult: '', weight: ''
formData: {},
formRules: {
classeName: [{ required: true, message: '请选择指标分类', trigger: 'change' }],
targetName: [{ required: true, message: '请输入指标名称', trigger: 'blur' }]
indicatorType: [{ required: true, message: '请选择指标分类', trigger: 'blur' }],
name: [{ required: true, message: '请选择指标名称', trigger: 'blur' }]
},
calsseDateList: [{ label: '坎坎坷坷', id: 1 }],
targetRadioList: [{ label: '量化指标', id: 0 }, { label: '行为价值观指标', id: 1 }, { label: '团队管理', id: 2 }]
calsseDataList: [{ id: 0, name: '未分类指标' }], // {id:2,name:'',type:1,orderBy:''}
targetTypeList: [] // {id:2,name:'',type:1,orderBy:''}
}
}
}

View File

@ -14,8 +14,8 @@
placeholder="搜索指标"
style="width:200px;"
size="small"
v-model="headerSearchValue"
@change="handleHeaderSearch"
v-model="queryData.name"
@change="handleGetTargetList(queryData.indicatorType,queryData.type, queryData.name)"
></el-input>
</el-col>
<el-col
@ -39,36 +39,57 @@
>删除</el-button>
</el-col>
</el-row>
<div
class="target-main-header-tags"
v-if="this.selectedTargetType"
>筛选条件<el-tag
@close="handleFilterTagClose"
type="warning"
closable
size="small"
>{{this.selectedTargetType.name}}</el-tag>共筛选出<span class="target-main-header-tags-sum">{{this.tableData.length}}</span>个指标</div>
</div>
<div class="target-main-content">
<div :class=" menuDataClasseHide?'target-main-content-left target-classe-menu-hide':'target-main-content-left target-classe-menu-show'">
<el-table
ref="refMenuTable"
:data="tableMenuData"
height="400px"
:header-cell-style="{background:'#f5f4f5'}"
highlight-current-row
@row-click="handleMenuCurrentChange"
@cell-mouse-enter="handleMenuMouseEnter"
@cell-mouse-leave="handleMenuMouseLeave"
:row-class-name="tableMenuRowClassName"
>
<el-table-column
label="指标分类"
prop="name"
:show-overflow-tooltip="true"
></el-table-column>
>
<template slot-scope="scope">
<div>{{scope.row.name}}({{scope.row.count}})</div>
</template>
</el-table-column>
<el-table-column width="40px">
<template slot="header">
<el-button
type="text"
icon="el-icon-plus"
size="small"
@click="handleAddCalsse"
@click="handleMenuAddCalsse"
></el-button>
</template>
<template slot-scope="scope">
<el-dropdown @command="handleClasseDropdown">
<el-dropdown
@command="handleClasseDropdown"
v-if="scope.row.delete===0"
szie="small"
>
<div
style="width:40px;height:23px;"
class="el-dropdown-link"
@mousemove="selectedMenuRowIndex=scope.$index"
@mouseout="selectedMenuRowIndex=-1"
>{{selectedMenuRowIndex===scope.$index?'...':' '}}</div>
style="width:30px;height:15px;color: #3ba1ff;"
>{{selectedMenuRowEditIndex===scope.$index?'...':''}}</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
:command="{obj:scope.row,type:0}"
@ -94,11 +115,12 @@
height="400px"
:header-cell-style="{background:'#f5f4f5'}"
@selection-change="handleSelectionChange"
@row-click="handleTargetCurrentRowChange"
>
<div
slot="empty"
class="comonPromptFont"
>{{$isStringEmpty(this.headerSearchValue)?'暂无数据':'未找到关于'+this.headerSearchValue+'的结果'}}</div>
>{{$isStringEmpty(this.queryData.name)?'暂无数据':'未找到关于'+this.queryData.name+'的结果'}}</div>
<el-table-column type="selection"></el-table-column>
<el-table-column
label="名称"
@ -110,102 +132,365 @@
sortable
prop="type"
></el-table-column>
<el-table-column label="考核标准"></el-table-column>
<el-table-column
label="考核标准"
prop="keyResult"
></el-table-column>
<el-table-column
label="权重"
sortable
prop="quanzhong"
></el-table-column>
prop="weight"
>
<template slot-scope="scope">
{{scope.row.weight}}%
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
<target-filtrate :isShowTargetFiltrate.sync="dialogVisibleFilter" />
<popup-radio :isShowPopupRadio="dialogVisibleMoving" />
<target-filtrate
:isShowTargetFiltrate.sync="dialogVisibleFilter"
@cd="handlePopupFiltrateSubmit"
/>
<popup-radio
:isShowPopupRadio.sync="dialogVisibleMoving"
@cd="handlePopupMove"
/>
<el-dialog
:visible.sync="dialogMenuListModel.visible"
:title="dialogMenuListModel.title"
width="500px"
>
<el-form size="small">
<el-form-item
label="分类名称:"
required
label-width="100px"
>
<el-input v-model="dialogMenuListModel.name" />
</el-form-item>
</el-form>
<span
slot="footer"
class="dialog-footer"
>
<el-button @click="dialogMenuListModel.visible = false"> </el-button>
<el-button
type="primary"
@click="handleDialogMenuListUpdateSubmit"
> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import TargetFiltrate from '@/components/TargetFiltrate'
import PopupRadio from '@/components/PopupRadio'
import { apiGetIndicatorLibraryList, apiGetIndicatorTypeDelete, apiGetIndicatorLibraryStatistical, apiGetIndicatorTypeEdit, apiGetIndicatorLibraryItemsMove, apiGetIndicatorLibraryItemsDelete } from '@/api/target'
export default {
methods: {
handleHeaderSearch (val) {
console.log('搜索指标' + this.headerSearchValue)
},
handleAdd () {
//
this.$router.push({ name: 'workbench-target-add' })
console.log('新增指标')
},
handlePopupMove (val) {
//
console.log('移动指标分类')
console.log(val)
let ids = this.selectedRowList.map(item => {
return item.id
}).join(',')
let para = {
ids: ids,
indicatorType: val
}
apiGetIndicatorLibraryItemsMove(para).then(res => {
if (res.code === 200) {
this.$message.success(res.msg)
this.selectedRowList = []
this.handleGetMenuList(this.queryData.type)
} else {
this.$message.error(res.msg)
}
})
},
handleRemove () {
console.log('删除指标')
this.$confirm('确认删除选中指标', '提示').then(() => {
console.log('确认删除选中指标')
let ids = this.selectedRowList.map(item => {
return item.id
}).join(',')
apiGetIndicatorLibraryItemsDelete({ ids: ids }).then(res => {
if (res.code === 200) {
this.$message.success(res.msg)
this.selectedRowList = []
this.handleGetMenuList(this.queryData.type)
} else {
this.$message.error(res.msg)
}
})
}).catch(() => {
this.selectedMenuRowModel = null
})
},
handleAddCalsse () {
console.log('添加分类')
handleFilterTagClose () {
//
this.selectedTargetType = null
this.queryData.type = -1
this.handleGetMenuList(this.queryData.type)
},
handleMenuAddCalsse () {
this.dialogMenuListModel.title = '新建分类'
this.dialogMenuListModel.name = ''
this.dialogMenuListModel.type = 0
this.dialogMenuListModel.visible = true
},
tableMenuRowClassName ({ row, rowIndex }) {
// index
row['index'] = rowIndex
if (this.queryData.indicatorType === row.indicatorType) {
return 'target-classe-row-edit-selected'
}
return 'target-classe-row-edit'
},
handleMenuCurrentChange (row, column) {
//
if (this.queryData.indicatorType === row.indicatorType) {
return
}
this.selectedRowList = []
this.queryData.indicatorType = row.indicatorType !== null ? row.indicatorType : -1
this.handleGetTargetList(this.queryData.indicatorType, this.queryData.type, this.queryData.name)
},
handleMenuMouseEnter (row) {
//
this.selectedMenuRowEditIndex = row.index
},
handleMenuMouseLeave (row) {
//
this.selectedMenuRowEditIndex = -1
},
handleDialogMenuListUpdateSubmit () {
//
if (this.$isStringEmpty(this.dialogMenuListModel.name)) {
this.$message.error('分类名称不能为空')
return
}
let para = {
name: this.dialogMenuListModel.name,
type: 0
}
if (this.dialogMenuListModel.type === 1) {
para['id'] = this.selectedMenuRowModelEdit.indicatorType
}
apiGetIndicatorTypeEdit(para).then(res => {
this.dialogMenuListModel.visible = false
if (res.code === 200) {
this.$message.success(res.msg)
if (this.dialogMenuListModel.type === 1) {
//
this.selectedMenuRowModelEdit.name = this.dialogMenuListModel.name
} else {
this.handleGetMenuList(this.queryData.type)
}
} else {
this.$message.success(res.msg)
}
})
},
handleClasseDropdown (val) {
let { type, obj } = val
this.selectedMenuRowModelEdit = obj
if (type === 0) {
//
this.$prompt('分类名称:', '修改分类', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
console.log('修改分类名称:' + value)
}).catch(() => {
})
this.dialogMenuListModel.title = '修改分类'
this.dialogMenuListModel.name = obj.name
this.dialogMenuListModel.type = 1
this.dialogMenuListModel.visible = true
} else if (type === 1) {
//
this.$confirm('您确定要删除此分类吗?', '提示').then(() => {
console.log('确定删除分类')
apiGetIndicatorTypeDelete({ id: this.selectedMenuRowModelEdit.indicatorType }).then(res => {
if (res.code === 200) {
this.selectedMenuRowModelEdit = null
this.queryData.indicatorType = -1
this.handleGetMenuList(this.queryData.type)
} else {
this.$message.error(res.msg)
}
})
}).catch(() => {
this.selectedMenuRowModel = null
})
console.log('移除指标')
}
},
//
handleTargetCurrentRowChange (val) {
let changeVal = {
id: val.id,
name: val.name,
keyResult: val.keyResult,
weight: val.weight,
type: val.type,
indicatorType: val.indicatorType
}
this.$router.push({ name: 'workbench-target-add', query: changeVal })
},
handleSelectionChange (val) {
this.selectedRowList = val
},
handlePopupFiltrateSubmit (val) {
//
console.log('筛选类型----')
console.log(val)
this.selectedTargetType = val
this.queryData.type = val ? val.id : -1
this.handleGetMenuList(this.queryData.type)
},
handleGetMenuList (type = -1) {
// type
//
let para = {}
if (type !== -1) {
para['type'] = type
}
apiGetIndicatorLibraryStatistical(para).then(res => {
if (res.code === 200) {
this.tableMenuData = res.data.map(item => {
if (item.indicatorType === null) {
item.indicatorType = -1
}
return item
})
console.log('获取类型')
console.log(this.tableMenuData)
this.tableMenuData.forEach((item, index) => {
if (item.indicatorType === this.queryData.indicatorType) {
//
this.$refs.refMenuTable.setCurrentRow(item)
this.handleGetTargetList(this.queryData.indicatorType, this.queryData.type, this.queryData.name)
}
})
} else {
this.$message.error(res.msg)
}
})
},
//
handleGetTargetList (indicatorType = -1, type = -1, name = '', currPage = 1) {
console.log(name)
this.queryData.name = name
this.queryData.indicatorType = indicatorType
let para = {
currPage: currPage,
pageSize: 20,
name: name
}
if (indicatorType !== -1) {
para['indicatorType'] = indicatorType
}
if (type !== -1) {
para['type'] = type
}
apiGetIndicatorLibraryList(para).then(res => {
if (res.code === 200) {
let data = res.data
this.tablePage.totalCount = data.totalCount
this.tablePage.totalPage = data.totalPage
this.tablePage.pageSize = data.pageSize
this.tablePage.currPage = data.currPage
this.tableData = data.list
}
})
}
},
components: {
TargetFiltrate,
PopupRadio
},
created () {
this.handleGetMenuList()
},
data () {
return {
headerSearchValue: '',
queryData: {
name: '', //
indicatorType: -1, // -1
type: -1 //
},
dialogVisibleFilter: false,
dialogVisibleMoving: false,
tableMenuData: [{ name: '收代理费建安费啦k咳咳咳书法家阿李师傅', id: '1' }],
tableData: [{ name: '收快递费可是', type: '水电费', quanzhong: '40%' }, { name: '收快递费可是', type: '水电费', quanzhong: '40%' }],
tableMenuData: [], // { name: '', indicatorType: 0,count:1 }
tableData: [], //
menuDataClasseHide: false,
selectedMenuRowEditIndex: -1, //
selectedMenuRowModelEdit: null, //
selectedRowList: [],
selectedMenuRowIndex: -1,
selectedMenuRowModel: null
tablePage: {
totalCount: 0,
pageSize: 20,
totalPage: 1,
currPage: 1
},
selectedTargetType: null,
dialogMenuListModel: {
visible: false,
title: '新建分类',
name: '',
type: 0 // 0 1
}
}
}
}
</script>
<style lang="less">
.target-classe-row-edit {
color: #52575b !important;
}
.target-classe-row-edit-selected {
color: @fontBlue !important;
}
.target-classe-row-edit:hover {
cursor: pointer;
color: @fontBlue !important;
}
</style>
<style lang="less" scoped>
.target {
background-color: white;
padding: 28px;
background-color: #fff;
&-main-header {
&-tags {
padding: 10px 0px;
.el-tag {
margin-right: 10px;
}
&-sum {
color: @fontBlue;
font-size: 14px;
}
}
}
&-classe-menu-hide {
width: 1px;
}
&-classe-menu-show {
width: 200px;
}
&-font-blue {
color: @fontBlue;
}
&-font-def {
color: #52575b;
}
&-main {
&-header-right {
display: flex;