This commit is contained in:
xiongchengqiang 2020-12-09 19:58:36 +08:00
parent c50298aba6
commit 6cbae7c47e
3 changed files with 96 additions and 27 deletions

View File

@ -46,9 +46,9 @@
</div>
<div style="width:20%">
<el-progress type="circle"
:width='50'
:width='40'
:stroke-width='4'
:percentage="25"></el-progress>
:percentage="handleGetProgress(j,j.taskDtos)"></el-progress>
</div>
<div style="width:10%">{{ Math.round((j.checkWeight * 100)*1000)/1000}}%</div>
<div style="width:20%">
@ -69,10 +69,10 @@
</el-button>
</div>
</div>
<div v-for="(kitem,indexK) in handleFilter(j.arr)"
<div v-for="(kitem,indexK) in handleFilter(j.taskDtos)"
:key="indexK"
class="goals-content-tabbar-table-content-bottom">
<div>{{kitem.name}}({{kitem.process|| 0}}%)</div>
<div>{{kitem.name}}({{Math.round((kitem.processRate * 100)*1000)/1000|| 0}}%)</div>
<div style="width:10%">
<el-button type="text"
@click="hanidleAddTask(j,1,kitem)"
@ -131,9 +131,9 @@
<el-form-item label="任务进度"
prop="weight">
<el-input size="small"
@blur="$handleBlur('formTask.process')"
@input.native="$handleInputInt('formTask.process')"
v-model="formTask.process">
@blur="$handleBlur('formTask.processRate')"
@input.native="$handleInputInt('formTask.processRate')"
v-model="formTask.processRate">
<template slot="append">%</template>
</el-input>
</el-form-item>
@ -217,7 +217,7 @@ export default {
editItem: {},
formTask: {
name: '',
process: '0'
processRate: '0'
},
zhibiaoTitle: '添加指标',
showIndicators: false,
@ -282,11 +282,15 @@ export default {
methods: {
//
handleDeleteTask (parent, item) {
parent.arr.map(i => {
if (item.id) {
parent.taskDtos.map(i => {
if (i === item) {
i.isDelete = 1
}
})
} else {
parent.taskDtos = parent.taskDtos.filter(i !== item)
}
this.$forceUpdate()
},
//
@ -297,12 +301,13 @@ export default {
handleSubmitTask () {
this.$refs.formTask.validate((v) => {
if (v) {
this.formTask.processRate = Number(this.formTask.processRate) / 100
if (this.formTask.isNew) {
delete this.formTask.isNew
this.formItem.arr.push(this.formTask)
this.formItem.taskDtos.push(this.formTask)
} else {
this.editItem.name = this.formTask.name
this.editItem.process = this.formTask.process || "0"
this.editItem.processRate = this.formTask.processRate || "0"
}
this.$forceUpdate()
this.handleCancelTask()
@ -310,24 +315,33 @@ export default {
}
})
},
handleGetProgress (process, arr = []) {
const result = this.handleFilter(arr).reduce((result, item) => {
result += Number(item.processRate)
return result
}, 0)
const _process = Number(result.toFixed(2)) / this.handleFilter(arr).length || 0
process.processRate = _process || 0
return Number((_process * 100).toFixed(2))
},
hanidleAddTask (j, type, item) {
!j.arr && (j.arr = [])
!j.taskDtos && (j.taskDtos = [])
this.formTask = {}
if (type === 1) {
this.formTask = Object.assign({}, item)
this.formTask = Object.assign({}, item, { processRate: item.processRate })
this.editItem = item
this.taskTitle = '编辑任务'
} else {
this.taskTitle = '添加任务'
this.formTask = {
name: '',
process: '0',
processRate: '0',
isNew: true
}
}
// this.formTask = type === 1 ? Object.assign({}, item, { item }) : {
// name: '',
// process: '0',
// processRate: '0',
// isNew: true
// }
this.formItem = j
@ -359,9 +373,14 @@ export default {
}
} else {
for (let i in arr) {
if (arr[i].detailDtos.length > 0 && !arr[i].isTrue) {
this.$message.error(arr[i].name + '维度内的权重和必须为' + Math.round((arr[i].weight * 100) * 1000) / 1000)
return
let num = 0
arr[i].detailDtos.map(l => {
num += l.weight
})
if (num.toFixed(2) !== arr[i].weight.toFixed(2)) {
debugger
return this.$message.error(arr[i].name + '维度内的权重和必须为' + Math.round((arr[i].weight * 100) * 1000) / 1000)
}
}
}

View File

@ -1,18 +1,32 @@
<!-- -->
<template>
<div>
Pinglun
<div class="pinglunTem">
<div class="pinglunTem-left">
<img src="@/assets/img/default.jpg"
alt="">
</div>
<div class="pinglunTem-right">
<div class="pinglunTem-right-title">
<div><span>十万</span><span class="beizhu">#开机后即可很快就#</span></div>
<div>2020-12-12 12:00:00</div>
</div>
<div class="pinglunTem-right-content">
将骄傲和公司的环境kg阿克苏较好的噶好几款是个大括号建安公司大家观看
</div>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
data () {
return {
}
},
computed: {},
computed: {
},
beforeMount () { },
mounted () { },
methods: {},
@ -22,5 +36,40 @@ export default {
</script>
<style lang='' scoped>
<style lang='less' scoped>
.pinglunTem {
display: flex;
&-left {
width: 40px;
margin: 0 10px 0 0;
img {
width: 40px;
height: 40px;
}
}
&-right {
flex: 1 0 auto;
&-title {
color: #999b9d;
display: flex;
justify-content: space-between;
align-content: center;
margin-bottom: 10px;
}
&-content {
border: 1px solid #bdd7f4;
background: #cfe5fc;
border-radius: 0 6px 6px 6px;
color: #313841;
font-size: 12px;
max-width: 400px;
padding: 4px 6px;
}
.beizhu {
margin-left: 10px;
font-size: 12px;
color: @fontBlue;
}
}
}
</style>

View File

@ -50,7 +50,7 @@
</div>
<div class="pinglun-bottom">
<el-input type="textarea"
:resize='false'
placeholder="请输入评论内容"
v-model="form.desc"></el-input>
<el-button size="small"
type="primary">发送</el-button>
@ -229,6 +229,7 @@ export default {
textarea {
resize: none;
height: 46px;
font-size: 12px;
background: #f6f6f6;
}
.el-button--small {