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

View File

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