指定目标

考核模板
添加选择指标项
This commit is contained in:
zhujida 2021-01-22 16:57:03 +08:00
parent 654de5b250
commit 449613c13e
8 changed files with 997 additions and 551 deletions

View File

@ -9,36 +9,60 @@
subumitText="确定"
class="popup commonFont"
>
<div slot="content">
<div class="search-header">
<div
slot="content"
class="popup-choose-target"
>
<div class="popup-choose-target-header">
<el-button
@click="handleFiltrate"
@click="isShowPopupFiltrate = true"
type="primary"
plain
size="small"
>筛选</el-button>
<el-input
@change="handleSearch"
v-model="searchInputValue"
v-model="queryData.name"
placeholder="请输入内容"
prefix-icon="el-icon-search"
size="small"
clearable
></el-input>
</div>
<!-- <div
class="popup-choose-target-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> -->
<el-table
data="tableData"
selection-change="handleSelectionChange"
:data="tableData"
@selection-change="handleSelectionChange"
>
<div
slot="empty"
class="comonPromptFont"
>{{$isStringEmpty(this.queryData.name)?'暂无数据':'未找到关于'+this.queryData.name+'的结果'}}</div>
<el-table-column
type="selection"
width="40"
>
</el-table-column>
<el-table-column
label="全选"
prop="name"
></el-table-column>
<el-table-column
align="right"
label=""
prop="quanzhong"
width="60px"
></el-table-column>
prop="weight"
width="100px"
:formatter="(row,column,cellValue,index)=> cellValue*100+'%'"
>
</el-table-column>
</el-table>
<div class="comonPromptFont filtrate-prompt">没有更多了</div>
<div
@ -50,48 +74,104 @@
</popup-right>
<target-filtrate
:isShowTargetFiltrate.sync="isShowPopupFiltrate"
@cb="handelTargetFilter"
:indicatorType.sync="queryData.indicatorType"
@cd="handelTargetFilterSubmit"
:isClasseType="true"
/>
</div>
</template>
<script>
import PopupRight from '@/components/PopupRight'
import TargetFiltrate from '@/components/TargetFiltrate'
import { apiGetIndicatorLibraryList } from '@/api/target'
export default {
methods: {
handleFiltrate () {
console.log('筛选-标签类别')
},
handleSearch (val) {
console.log('搜索-----')
console.log(val)
this.handleGetTargetList(this.queryData.indicatorType, this.queryData.name)
},
handleSelectionChange (val) {
//
this.selectedList = val
console.log('选中------')
console.log(val)
},
handelTargetFilter (list) {
handelTargetFilterSubmit (val) {
//
this.isShowPopupFiltrate = true
console.log(list)
this.selectedTargetType = val
this.queryData.indicatorType = val ? val.id : -1
this.handleGetTargetList(this.queryData.indicatorType, this.queryData.name)
},
handleFilterTagClose () {
//
this.selectedTargetType = null
this.queryData.type = -1
this.handleGetTargetList(this.queryData.indicatorType, this.queryData.name)
},
hundlePopupHide () {
this.$emit('update:isShowPopup', false)
},
handleSubmitPopup () {
this.$emit('cd', this.selectedList)
// this.$emit('update:isShowPopup', false)
console.log('选中')
console.dir(this.selectedList)
this.$emit('update:isShowPopup', false)
},
//
handleGetTargetList (indicatorType = -1, name = '') {
this.selectedList = []
this.queryData.name = name
this.queryData.indicatorType = indicatorType
let para = {
currPage: 1,
pageSize: 2000,
name: name
}
if (indicatorType !== -1) {
para['indicatorType'] = indicatorType
}
if (this.dimensionTypeId !== -1) {
para['type'] = this.dimensionTypeId
}
apiGetIndicatorLibraryList(para).then(res => {
if (res.code === 200) {
let data = res.data
let nowDataList = data.list.filter(item => {
let nowItem = this.filtersList.filter(filter => {
return item.name === filter.name
})
return nowItem.length === 0
})
this.$nextTick(res => {
this.tableData = nowDataList
})
}
})
}
},
data () {
return {
isShowPopupFiltrate: false,
searchInputValue: '',
selectedTargetType: null,
queryData: {
name: '',
indicatorType: -1 //
},
tableData: [],
selectedList: []
}
},
watch: {
isShowPopup (now) {
if (now) {
this.handleGetTargetList()
} else {
this.queryData.indicatorType = -1
this.queryData.name = ''
this.tableData = []
}
}
},
components: {
PopupRight,
TargetFiltrate
@ -101,17 +181,42 @@ export default {
type: Boolean,
default: false
},
dataList: {
//
filtersList: {
type: Array,
default: () => {
return [{ id: 1, name: '全部指标' }, { id: 2, name: '全部指标' }]
return []
}
},
// ID
dimensionTypeId: {
type: Number,
default: -1
}
}
}
</script>
<style lang="less" scoped>
.popup {
&-choose-target {
&-header {
display: flex;
margin-bottom: 10px;
.el-button {
margin-right: 10px;
}
}
}
&-tags {
padding: 10px 0px;
.el-tag {
margin-right: 10px;
}
&-sum {
color: @fontBlue;
font-size: 14px;
}
}
.filtrate-prompt {
text-align: center;
padding: 15px;

View File

@ -42,6 +42,7 @@ export default {
apiGetIndicatorType({ type: 0 }).then(res => {
if (res.code === 200) {
this.tableData = res.data.list
this.tableData.push({ id: 0, name: '未分类指标' })
}
})
}
@ -67,6 +68,9 @@ export default {
isShowPopupRadio (now) {
if (now) {
this.handleGetClasseList()
} else {
this.radioSelectedId = ''
this.tableData = []
}
}
},

View File

@ -33,6 +33,8 @@
<script>
import PopupRight from '@/components/PopupRight'
import { apiGetIndicatorType } from '@/api/target'
import { getDimensions } from '@/api/data'
export default {
methods: {
hundlePopupHide () {
@ -53,21 +55,36 @@ export default {
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)
})
//
if (this.isClasseType) {
let para = {
currPage: 1,
pageSize: 200,
type: 0
}
})
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)
})
}
})
} else {
//
//
getDimensions().then(res => {
this.$nextTick(() => {
if (res.code !== 200) {
this.listData[0].list = []
this.$message.error(res.msg)
return
}
this.listData[0].list = [{ id: -1, name: '全部' }].concat(res.data)
})
})
}
}
},
data () {
@ -81,9 +98,9 @@ export default {
radioTage: 1,
listData: [
{
title: '类型',
title: this.isClasseType ? '分类' : '类型',
id: 'id',
selectedId: -1,
selectedId: this.indicatorType,
btnDef: 'area-content-item btn-def',
btnSelected: 'area-content-item btn-def btn-def-selected',
list: []
@ -104,12 +121,11 @@ export default {
},
watch: {
isShowTargetFiltrate (now, old) {
console.log('old:' + old)
console.log('now:' + now)
if (now) {
this.handleGetTargetTypelist()
}
}
},
props: {
isShowTargetFiltrate: {
@ -119,6 +135,14 @@ export default {
popupRightTitle: {
default: '筛选',
type: String
},
isClasseType: {
type: Boolean,
default: false // FALSE true
},
indicatorType: {
default: -1,
type: Number
}
},
components: {

View File

@ -135,7 +135,7 @@
</div>
<div style=" padding: 10px;">
<el-button
@click="handelChooseTarger(i,index)"
@click="handelChooseTarger(i,-1,index)"
icon="el-icon-finished"
type="primary"
size="small"
@ -299,6 +299,12 @@
>提交</el-button>
</div>
</div>
<!-- 选择指标项 -->
<ChooseTarget
:isShowPopup.sync="popupChooseTargetModel.isShow"
:dimensionTypeId.sync="popupChooseTargetModel.dimensionTypeId"
@cd="handleChooseTargetSubmit"
/>
</div>
</template>
@ -306,81 +312,13 @@
import SmallNav from '@/components/kpi-layout/SmallNav'
import InfoHeader from '@/components/InfoHeader'
import PopupRight from '@/components/PopupRight'
import ChooseTarget from '@/components/ChooseTarget'
import draggable from 'vuedraggable'
import { getDimensions } from '@/api/data'
import { apiResultGetDetail, apiSaveDetail, apiSaveapproval } from '@/api/assessment'
import delete$ from 'dingtalk-jsapi/api/biz/cspace/delete'
export default {
data () {
return {
showTask: false,
taskTitle: '添加任务',
formItem: {},
editItem: {},
formTask: {
name: '',
processRate: '0'
},
zhibiaoTitle: '添加指标',
showIndicators: false,
dimensionsList: [],
formIndicators: {},
ruleIndicators: {
name: [{
required: true,
message: '请输入任务名称',
trigger: 'blur'
}
],
target: [{
required: true,
message: '请输入指标名称',
trigger: 'blur'
}
],
keyResult: [{
required: true,
message: '请输入考核标准',
trigger: 'blur'
}
],
checkWeight: [{
required: true,
message: '请输入权重大小',
trigger: 'blur'
}
]
},
activeId: null,
obj: {
recortModelDto: []
},
options1: {
group: 'names',
draggable: '.items',
handle: '.my-handle',
scroll: true,
sort: true, //
delay: 0, //
touchStartThreshold: 0, // px,?
disabled: false, // sortable
store: null, // @see Store
animation: 150 // ms, ' 0 ' -
}
}
},
components: {
SmallNav,
InfoHeader,
draggable,
PopupRight
},
computed: {},
beforeMount () { },
mounted () {
this.handleGetDimensions()
this.handleGetTbale()
},
methods: {
//
handleDeleteTask (parent, item) {
@ -622,6 +560,7 @@ export default {
this.$refs.formIndicators.validate((v) => {
if (v) {
if (this.formIndicators.index === -1) {
let sssf = Object.assign({}, this.formIndicators, { checkWeight: this.formIndicators.checkWeight / 100 })
arr.push(Object.assign({}, this.formIndicators, { checkWeight: this.formIndicators.checkWeight / 100 }))
} else {
let _index = 0
@ -640,11 +579,33 @@ export default {
}
})
},
handelChooseTarger (item, index) {
handelChooseTarger (item, index, type) {
//
console.log('选择指标项-------')
console.dir(item)
console.log(index)
if (item.maxCount !== null) {
const len = this.handleNumber(item)
if (item.maxCount <= len) {
this.$message.info('指标数量不能大于' + item.maxCount)
return
}
}
this.popupChooseTargetModel.dimensionTypeId = item.type
this.popupChooseTargetModel.dazhibiaoIndex = type
this.$forceUpdate()
this.popupChooseTargetModel.isShow = true
},
handleChooseTargetSubmit (list) {
if (list.length <= 0) {
return
}
//
const index = this.popupChooseTargetModel.dazhibiaoIndex
const arr = this.obj.recortModelDtos[index].detailDtos
let nowList = list.map(item => {
return { isDelete: 0, checkWeight: item.weight * 100 / 100, target: item.name, keyResult: item.keyResult, type: item.type }
})
this.obj.recortModelDtos[index].detailDtos = arr.concat(nowList)
},
//
hanidleEdit (item, index, type) {
@ -697,7 +658,83 @@ export default {
this.activeId = String(res.data.recortModelDtos[0].id)
}
},
watch: {}
watch: {},
data () {
return {
showTask: false,
taskTitle: '添加任务',
formItem: {},
editItem: {},
formTask: {
name: '',
processRate: '0'
},
zhibiaoTitle: '添加指标',
showIndicators: false,
dimensionsList: [],
formIndicators: {},
ruleIndicators: {
name: [{
required: true,
message: '请输入任务名称',
trigger: 'blur'
}
],
target: [{
required: true,
message: '请输入指标名称',
trigger: 'blur'
}
],
keyResult: [{
required: true,
message: '请输入考核标准',
trigger: 'blur'
}
],
checkWeight: [{
required: true,
message: '请输入权重大小',
trigger: 'blur'
}
]
},
activeId: null,
obj: {
recortModelDto: []
},
options1: {
group: 'names',
draggable: '.items',
handle: '.my-handle',
scroll: true,
sort: true, //
delay: 0, //
touchStartThreshold: 0, // px,?
disabled: false, // sortable
store: null, // @see Store
animation: 150 // ms, ' 0 ' -
},
popupChooseTargetModel: {
isShow: false, //
dimensionTypeId: -1, //
dazhibiaoIndex: 0 //
}
}
},
components: {
SmallNav,
InfoHeader,
draggable,
PopupRight,
ChooseTarget
},
computed: {},
beforeMount () { },
mounted () {
this.handleGetDimensions()
this.handleGetTbale()
}
}

View File

@ -76,8 +76,8 @@
v-model="formData.weight"
placeholder="请输入指标名称"
clearable
oninput="value=value.replace(/^\.+|[^\d.]/g,'')"
@change="handleWeightChange"
@blur="$handleBlur('formData.weight')"
@input.native="$handleInputInt('formData.weight')"
>
<el-button slot="append">%</el-button>
</el-input>
@ -96,78 +96,97 @@
</template>
<script>
import { apiGetIndicatorType, apiGetIndicatorLibraryEdit } from '@/api/target'
import { getDimensions } from '@/api/data'
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
// }
// 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)
// }
// }
}
},
// // }
// // console.log(weightTwo)
// // }
// // }
// }
// },
handleSaveSet () {
//
this.$refs.formTarget.validate((valid) => {
if (valid) {
apiGetIndicatorLibraryEdit(this.formData).then(res => {
let weight = this.formData.weight
if (weight) {
weight = this.formData.weight / 100 > 1 ? 1 : this.formData.weight / 100
}
let para = {
indicatorType: this.formData.indicatorType,
type: this.formData.type,
name: this.formData.name,
keyResult: this.formData.keyResult,
weight: weight
}
if (this.formData.id) {
para['id'] = this.formData.id
}
apiGetIndicatorLibraryEdit(para).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) {
handleGetIndicatorType () {
let para = {
currPage: 1,
type: type,
type: 0,
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
}
//
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 {
if (type === 0) {
this.formData.indicatorType = 0
}
this.$message.error(res.msg)
}
})
},
handleGetDimensionsList () {
//
getDimensions().then(res => {
if (res.code !== 200) {
this.targetTypeList = []
this.$message.error(res.msg)
return
}
this.targetTypeList = res.data
if (this.targetTypeList.length > 0 && this.changeTargetId === -1) {
let item = res.data[0]
this.formData.type = item.id
}
})
}
@ -180,14 +199,14 @@ export default {
this.formData = this.$route.query
}
//
this.handleGetIndicatorType(0)
this.handleGetIndicatorType(1)
this.handleGetIndicatorType()
this.handleGetDimensionsList()
},
data () {
return {
changeTargetId: -1, // id
// indicatorType: 0, type: 0, name: '', keyResult: '', weight: ''
formData: {},
formData: { indicatorType: 0, type: 0, name: '', keyResult: '', weight: '' },
formRules: {
indicatorType: [{ required: true, message: '请选择指标分类', trigger: 'blur' }],
name: [{ required: true, message: '请选择指标名称', trigger: 'blur' }]

View File

@ -132,7 +132,7 @@
<el-table-column
label="指标类型"
sortable
prop="type"
prop="typeName"
></el-table-column>
<el-table-column
label="考核标准"
@ -142,10 +142,8 @@
label="权重"
sortable
prop="weight"
:formatter="(row, column, cellValue, index)=>cellValue*100+'%'"
>
<template slot-scope="scope">
{{scope.row.weight}}%
</template>
</el-table-column>
</el-table>
<el-pagination
@ -348,10 +346,12 @@ export default {
id: val.id,
name: val.name,
keyResult: val.keyResult,
weight: val.weight,
weight: val.weight * 100,
type: val.type,
indicatorType: val.indicatorType
}
console.log('跳转')
console.dir(val)
this.$router.push({ name: 'workbench-target-add', query: changeVal })
},
handleSelectionChange (val) {

View File

@ -1,20 +1,45 @@
<!-- -->
<template>
<div class="eidt">
<div class="eidt-header">
<div @click="handleChangle(1)" :class="{active:active===1}" class="a commonFont" ><span class="eidt-header-circle">1</span>基础设置</div>
<div @click="handleChangle(2)" :class="{active:active===2}" class="a commonFont"><span class="eidt-header-circle">2</span>模板设计</div>
<div @click="handleChangle(3)" :class="{active:active===3}" class="a commonFont"><span class="eidt-header-circle">3</span>流程设计</div>
</div>
<div class="eidt-right">
<el-button :loading='loadings' type="primary" @click="handSaveBasisc"> </el-button>
</div>
<div class="eidt-content boderAndRadius">
<basis :basisForm.sync='basisForm' v-show="active===1"/>
<template-set :templateForm.sync='templateForm' v-show="active===2"/>
<process :processInfo.sync='processInfo' v-show="active===3"/>
</div>
<div class="eidt">
<div class="eidt-header">
<div
@click="handleChangle(1)"
:class="{active:active===1}"
class="a commonFont"
><span class="eidt-header-circle">1</span>基础设置</div>
<div
@click="handleChangle(2)"
:class="{active:active===2}"
class="a commonFont"
><span class="eidt-header-circle">2</span>模板设计</div>
<div
@click="handleChangle(3)"
:class="{active:active===3}"
class="a commonFont"
><span class="eidt-header-circle">3</span>流程设计</div>
</div>
<div class="eidt-right">
<el-button
:loading='loadings'
type="primary"
@click="handSaveBasisc"
> </el-button>
</div>
<div class="eidt-content boderAndRadius">
<basis
:basisForm.sync='basisForm'
v-show="active===1"
/>
<template-set
:templateForm.sync='templateForm'
v-show="active===2"
/>
<process
:processInfo.sync='processInfo'
v-show="active===3"
/>
</div>
</div>
</template>
<script>
@ -51,7 +76,7 @@ export default {
templateSet
},
computed: {},
beforeMount () {},
beforeMount () { },
created () {
const id = this.$route.query.id
this.$route.meta.title = !id ? '新增考评组' : '编辑考评组'
@ -106,7 +131,7 @@ export default {
this.loadings = true
try {
this.$loadingStart()
let res12 = await apiCheckStaff(Object.assign({}, this.basisForm, {confirm: 1}))
let res12 = await apiCheckStaff(Object.assign({}, this.basisForm, { confirm: 1 }))
let res = await saveBaseSet(this.basisForm)
if (res.code !== 200) {
this.loadings = false
@ -132,7 +157,7 @@ export default {
return i
})
}
let res1 = await saveDetailProcs(Object.assign({}, this.processInfo[i].chartDetails, {evaluationGroupId: this.basisForm.id}))
let res1 = await saveDetailProcs(Object.assign({}, this.processInfo[i].chartDetails, { evaluationGroupId: this.basisForm.id }))
if (res1.code !== 200) {
this.loadings = false
this.$loadingEnd()
@ -176,7 +201,7 @@ export default {
type: 'success',
duration: 1000,
onClose: () => {
this.$router.replace({name: 'workbench-group'})
this.$router.replace({ name: 'workbench-group' })
}
})
}
@ -188,23 +213,23 @@ export default {
</script>
<style lang='less' scoped>
.eidt{
.eidt {
position: relative;
&-right{
&-right {
position: absolute;
z-index: 50;
top: -(@headerHeight+30px);
z-index: 50;
top: -(@headerHeight+30px);
right: 0;
height: @headerHeight;
.center()
.center();
}
&-content{
&-content {
min-height: 600px;
background: #fff;
padding: 40px 28px;
overflow: auto;
}
&-header{
&-header {
cursor: pointer;
position: absolute;
z-index: 50;
@ -216,18 +241,18 @@ export default {
margin: auto;
display: flex;
justify-content: space-between;
>div{
flex:1;
> div {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
letter-spacing:1px
letter-spacing: 1px;
}
.active{
.active {
background: @fontBlue;
color: #fff;
}
&-circle{
&-circle {
margin: 0 4px;
display: inline-block;
border: 1px solid #eeeeee;