diff --git a/ruoyi-ui/src/api/kaohe/gather.js b/ruoyi-ui/src/api/kaohe/gather.js index a2b5f76..0b3189b 100644 --- a/ruoyi-ui/src/api/kaohe/gather.js +++ b/ruoyi-ui/src/api/kaohe/gather.js @@ -18,7 +18,7 @@ export function getGather(id) { } // 新增生成汇总 -export function addGather(data) { +export function addGather1(data) { return request({ url: '/kaohe/gather', method: 'post', @@ -26,6 +26,15 @@ export function addGather(data) { }) } +// 新增生成汇总 +export function addGather(data) { + return request({ + url: '/kaohe/gather/generateSum', + method: 'post', + data: data + }) +} + // 修改生成汇总 export function updateGather(data) { return request({ diff --git a/ruoyi-ui/src/components/RecursiveTree/index.vue b/ruoyi-ui/src/components/RecursiveTree/index.vue index 0ac7721..ed63293 100644 --- a/ruoyi-ui/src/components/RecursiveTree/index.vue +++ b/ruoyi-ui/src/components/RecursiveTree/index.vue @@ -2,23 +2,23 @@
- + - + :max="1" v-if="nodeData.type1==='1'||nodeData.type1==='0'"> - 标题 - 占比引用 - 不占比引用 + 标题 + 占比引用 + 不占比引用
@@ -57,14 +57,14 @@ export default { onChangeKaohe(parentNode){ this.$emit('change-kaohe', parentNode) }, - addChild(type) { - this.$emit('add-child', this.nodeData, type) + addChild(type1) { + this.$emit('add-child', this.nodeData, type1) }, removeNode() { this.$emit('remove-node', this.nodeData) }, - onAddChild(parentNode, type) { - this.$emit('add-child', parentNode, type) + onAddChild(parentNode, type1) { + this.$emit('add-child', parentNode, type1) }, onRemoveNode(nodeToRemove) { this.$emit('remove-node', nodeToRemove) diff --git a/ruoyi-ui/src/views/kaohe/gather/index.vue b/ruoyi-ui/src/views/kaohe/gather/index.vue index 142143e..9367956 100644 --- a/ruoyi-ui/src/views/kaohe/gather/index.vue +++ b/ruoyi-ui/src/views/kaohe/gather/index.vue @@ -26,7 +26,7 @@ v-hasPermi="['kaohe:gather:add']" >新增 - + - - - - + + + + @@ -164,6 +186,12 @@ export default { components: { TableColumn, RecursiveTree }, data() { return { + // 考核得分 + khdf:{ + open: false, + list: [], + tableHeader: [] + }, // 遮罩层 loading: true, // 选中数组 @@ -271,7 +299,11 @@ export default { }, /** 提交按钮 */ submitForm() { - console.log(this.treeData); + addGather(JSON.stringify(this.treeData)).then(response => { + this.$modal.msgSuccess("新增成功") + this.open = false + this.getList(); + }) /*this.$refs["form"].validate(valid => { if (valid) { if (this.form.id != null) { @@ -306,18 +338,41 @@ export default { ...this.queryParams }, `gather_${new Date().getTime()}.xlsx`) }, - handleAddChild(parentNode,type) { + handleAddChild(parentNode,type1) { if (!parentNode.data) { this.$set(parentNode, 'data', []) } - parentNode.data.push({ - type: type, - title: null, - id: null, - zb: null, - pcTitle: null, - data: [] - }) + if(type1==='0'){ + parentNode.data.push({ + type1: type1, + type: '0', + title: null, + id: null, + zb: null, + pcTitle: null, + data: [] + }) + } + if(type1==='1'){ + parentNode.data.push({ + type1: type1, + type: '1', + title: null, + id: null, + zb: null, + pcTitle: null + }) + } + if(type1==='2'){ + parentNode.data.push({ + type1: type1, + type: '1', + title: null, + id: null, + pcTitle: null + }) + } + }, handleRemoveNode(nodeToRemove) { const removeNode = (parent, node) => { @@ -354,9 +409,43 @@ export default { // 引用考核任务选择 选中数据 khrwRowChange(row) { this.khrw.parentNode.id = row.id; + this.khrw.parentNode.title = row.pcTitle; this.khrw.parentNode.pcTitle = row.pcTitle; this.khrw.open = false; }, + // 查看生成汇总 + viewKaoHeScore(row){ + this.khdf.list = []; + this.khdf.tableHeader = []; + this.khdf.open = true; + this.reset() + getGather(row.id).then(response => { + this.khdf.list = JSON.parse(response.data.tableData); + let btTabelTree = JSON.parse(response.data.tableHeader); + btTabelTree.forEach(item => { + item.prop = item.name; + if(item.children && item.children.length>0){ + this.setProp(item.children, item.prop) + } + }) + this.khdf.tableHeader = btTabelTree; + + console.log(this.khdf.tableHeader, this.khdf.list); + }) + }, + // 递归函数 设置prop参数 + setProp(list, prop){ + list.forEach(item=>{ + if(prop){ + item.prop = prop+'.'+item.name; + }else { + item.prop = item.name; + } + if(item.children && item.children.length>0){ + this.setProp(item.children, item.prop) + } + }) + }, } }