|
@@ -11,6 +11,7 @@
|
|
|
plain
|
|
|
icon="Plus"
|
|
|
size="mini"
|
|
|
+ :disabled="!isChild"
|
|
|
@click="handleAdd"
|
|
|
>新增</el-button>
|
|
|
</el-col>
|
|
@@ -81,7 +82,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" width="100">
|
|
|
<template #default="scope">
|
|
|
- <p class="indicitem" @click="handleDelete(scope.row)">删除</p>
|
|
|
+ <p class="indicitem" @click="handleDelete(item, scope.row)">删除</p>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -100,7 +101,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {apiGetIndicatordictionaryList, apiGetdataZBXList, apiGetIndicatordicsaveList, apiGetIndicatordicdeleteList} from '../../api/api'
|
|
|
+import {apiGetIndicatordictionaryList, apiGetdataZBXList,apiGetindicatorselectByCode, apiGetIndicatordicsaveList, apiGetIndicatordicdeleteList} from '../../api/api'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -111,6 +112,7 @@ export default {
|
|
|
expends: [],
|
|
|
indicItemoptions: [],
|
|
|
evaluationIndexData:[],
|
|
|
+ isChild: false,
|
|
|
itemForm: {
|
|
|
childName: '',
|
|
|
childCode: '',
|
|
@@ -132,7 +134,6 @@ export default {
|
|
|
currentPage: 1,
|
|
|
total: 0
|
|
|
},
|
|
|
- evalradio: {},
|
|
|
rowevalradio: {}
|
|
|
}
|
|
|
},
|
|
@@ -142,15 +143,20 @@ export default {
|
|
|
this.indicatoroptions = []
|
|
|
this.indicItemoptions = []
|
|
|
this.rowevalradio = row
|
|
|
+ if (!row.isChild) {
|
|
|
+ this.isChild = false
|
|
|
+ } else {
|
|
|
+ this.isChild = true
|
|
|
+ }
|
|
|
this.getIndicatorItemData(row)
|
|
|
this.getindicItemData()
|
|
|
},
|
|
|
- // 查询指标项数据
|
|
|
+ // 查询子指标数据
|
|
|
getIndicatorItemData(row, type) {
|
|
|
let that = this
|
|
|
let params = {
|
|
|
- pageNum: this.page.currentPage,
|
|
|
- pageSize: this.page.pagesize,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 50,
|
|
|
indicatorId: row.id
|
|
|
}
|
|
|
if (type) {
|
|
@@ -160,12 +166,12 @@ export default {
|
|
|
if (datas) {
|
|
|
that.indicatoroptions = datas
|
|
|
that.changeDateSelect = []
|
|
|
+ if (!this.isChild && datas.length === 0) {
|
|
|
+ this.getItemFromIndic(row)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- getRowKeys(row) {
|
|
|
- return row.id
|
|
|
- },
|
|
|
// 查询指标项条目
|
|
|
getindicItemData() {
|
|
|
let that = this
|
|
@@ -178,8 +184,14 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- cellClick(row, column, cell, event) {
|
|
|
-
|
|
|
+ //根据指标查询指标项
|
|
|
+ getItemFromIndic(row) {
|
|
|
+ let childitemForm = {
|
|
|
+ childName: row.indicatorName,
|
|
|
+ childCode: row.indicatorCode,
|
|
|
+ list: []
|
|
|
+ }
|
|
|
+ this.indicatoroptions.push(childitemForm)
|
|
|
},
|
|
|
//新增子指标
|
|
|
handleAdd() {
|
|
@@ -213,53 +225,66 @@ export default {
|
|
|
//新增/修改指标数据
|
|
|
handleSave() {
|
|
|
let that = this
|
|
|
- let params = that.indicatoroptions
|
|
|
- if (that.isSave) {
|
|
|
- params.id = this.evalradio.id
|
|
|
- }
|
|
|
- apiGetIndicatordicsaveList(params).then(datas =>{
|
|
|
- if (!that.isSave) {
|
|
|
- that.$message({
|
|
|
- message: '指标项新增成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- } else {
|
|
|
- that.$message({
|
|
|
- message: '指标项修改成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
+ let startFn = false
|
|
|
+ that.indicatoroptions.forEach(item =>{
|
|
|
+ if (item.childName === '' || item.childCode === '') {
|
|
|
+ if (item.list.length>0) {
|
|
|
+ startFn = true
|
|
|
+ }
|
|
|
}
|
|
|
- that.getIndicatorItemData(that.rowevalradio)
|
|
|
})
|
|
|
+ if (!startFn) {
|
|
|
+ let params = that.indicatoroptions
|
|
|
+ apiGetIndicatordicsaveList(params).then(datas =>{
|
|
|
+ if (!that.isSave) {
|
|
|
+ that.$message({
|
|
|
+ message: '指标项新增成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ that.$message({
|
|
|
+ message: '指标项修改成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ that.getIndicatorItemData(that.rowevalradio)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ that.$message({
|
|
|
+ message: '请输入子指标名称和子指标编码',
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
//删除指标数据
|
|
|
- handleDelete(row) {
|
|
|
+ handleDelete(data, row) {
|
|
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
- let that = this
|
|
|
- let paramsArr = [row.id]
|
|
|
- apiGetIndicatordicdeleteList(paramsArr.join(',')).then(datas =>{
|
|
|
- that.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
- that.changeDateSelect = []
|
|
|
- that.getIndicatorItemData(that.rowevalradio)
|
|
|
- })
|
|
|
+ if (row.id) {
|
|
|
+ let that = this
|
|
|
+ let paramsArr = [row.id]
|
|
|
+ apiGetIndicatordicdeleteList(paramsArr.join(',')).then(datas =>{
|
|
|
+ that.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ });
|
|
|
+ that.changeDateSelect = []
|
|
|
+ that.getIndicatorItemData(that.rowevalradio)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (data.list && data.list.length>0) {
|
|
|
+ data.list.forEach((it,index) =>{
|
|
|
+ if (it.optionCode === row.optionCode) {
|
|
|
+ data.list.splice(index, 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
- },
|
|
|
- rowClick(selection, row) {
|
|
|
- this.changeDateSelect = selection
|
|
|
- },
|
|
|
- handleSizeChange(val){
|
|
|
- this.page.pagesize = val
|
|
|
- },
|
|
|
- handleCurrentChange(val){
|
|
|
- this.page.currentPage =val
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|