Browse Source

完善

master
yangzhou-cyber 3 years ago
parent
commit
b2a495f607
5 changed files with 68 additions and 60 deletions
  1. +40
    -36
      src/utils/mixin.js
  2. +14
    -9
      src/views/assessingTarget/basicTarget.vue
  3. +3
    -3
      src/views/assessingTarget/search.vue
  4. +5
    -1
      src/views/basicTable/category.vue
  5. +6
    -11
      src/views/basicTable/conventional.vue

+ 40
- 36
src/utils/mixin.js View File

@@ -1,40 +1,44 @@
export let base = {
methods: {
reduceData(data) {
let arr = data;
let year, code, quota1;
return arr.map(item => {
if (item.quota1 != quota1 && (code == undefined || item.code == code) && (item.year == year || year == undefined)) {
quota1 = item.quota1;
item.quota1Row = arr.filter(child => {
return child.year == item.year && child.code == item.code && item.quota1 == child.quota1
}).length
}
if (item.code != code && (year == undefined || year == item.year)) {
code = item.code;
quota1 = ietm.quota1;
item.quota1Row = arr.filter(child => {
return child.year == item.year && child.code == item.code && item.quota1 == child.quota1
}).length
item.codeRow = arr.filter(child => {
return child.year == item.year && child.code == item.code
}).length
}
if (item.year != year) {
year = item.year;
code = item.code;
item.codeRow = arr.filter(child => {
return child.year == item.year && child.code == item.code
}).length
item.yearRow = arr.filter(child => {
return child.year == item.year
}).length;
}
return item;
})
try {
let arr = data;
let year, code, quota1;
return arr.map(item => {
if (item.quota1 != quota1 && (code == undefined || item.code == code) && (item.year == year || year == undefined)) {
quota1 = item.quota1;
item.quota1Row = arr.filter(child => {
return child.year == item.year && child.code == item.code && item.quota1 == child.quota1
}).length
}
if (item.code != code && (year == undefined || year == item.year)) {
code = item.code;
quota1 = item.quota1;
item.quota1Row = arr.filter(child => {
return child.year == item.year && child.code == item.code && item.quota1 == child.quota1
}).length
item.codeRow = arr.filter(child => {
return child.year == item.year && child.code == item.code
}).length
}
if (item.year != year) {
year = item.year;
code = item.code;
item.codeRow = arr.filter(child => {
return child.year == item.year && child.code == item.code
}).length
item.yearRow = arr.filter(child => {
return child.year == item.year
}).length;
}
return item;
})
} catch(e) {
console.log(e)
}
},
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex == 2) {
if (columnIndex == 1) {
if (row.yearRow) {
return {
rowspan: row.yearRow,
@@ -47,7 +51,7 @@ export let base = {
}
}
}
if (columnIndex == 3 || columnIndex == 4) {
if (columnIndex == 2 || columnIndex == 3) {
if (row.codeRow) {
return {
rowspan: row.codeRow,
@@ -60,7 +64,7 @@ export let base = {
}
}
}
if (columnIndex == 5) {
if (columnIndex == 4) {
if (row.quota1Row) {
return {
rowspan: row.quota1Row,
@@ -148,7 +152,7 @@ export let quota = {
}).length
}

return item;
})
},
@@ -166,7 +170,7 @@ export let quota = {
}
}
}
}
},
}

+ 14
- 9
src/views/assessingTarget/basicTarget.vue View File

@@ -65,26 +65,25 @@
min-width="150"
align="center"
prop="leaderDept"
class-name="select"
>
<template slot-scope="{ row, $index }">
<div
@dblclick="showDep($index, true)"
style="height: 45px;width:100%"
style="height:45px;width:100%;display:flex;align-item:center;justify-content:center"
>
<treeselect
@blur="
showSelect($index, false);
updateDep(row);
"
@blur="showDep($index,false)"
:multiple="true"
v-if="row.selectFocus"
v-model="row.leaderDept"
:options="department"
placeholder="请选择牵头部门"
:defaultExpandLevel="2"
:defaultExpandLevel="1"
:normalizer="
(d) => {
return {
id: d.name,
id: d.id,
label: d.name,
children:
d.children && d.children.length > 0
@@ -94,7 +93,7 @@
}
"
/>
<span v-else>{{ row.leaderDept }}</span>
<span v-else style="line-height:45px;">{{ row.leaderDept }}</span>
</div>
</template>
</el-table-column>
@@ -119,6 +118,7 @@
layout="total, prev, pager, next, jumper"
:pager-count="5"
class="ele-pagination-circle"
:flat="true"
@current-change="getDataList()"
/>
</el-card>
@@ -213,6 +213,8 @@ export default {
item.year = item.year + "";
item.focus = false;
item.selectFocus = false;
item.leaderDept=(item.leaderDept&&item.leaderDept.split(',').map(item=>parseInt(item)))||[];
console.log(item.leaderDept);
return item;
});
this.dataList = this.reduceData(data);
@@ -228,5 +230,8 @@ export default {
};
</script>

<style>
<style scoped>
/deep/ .select, /deep/.select .cell {
overflow: visible !important;
}
</style>

+ 3
- 3
src/views/assessingTarget/search.vue View File

@@ -55,7 +55,7 @@
v-model="searchParams.leaderDept"
:options="department"
placeholder="请选择牵头部门"
:defaultExpandLevel="2"
:defaultExpandLevel="1"
:normalizer="
(d) => {
return {
@@ -72,11 +72,11 @@
v-model="searchParams.cooperateDept"
:options="department"
placeholder="请选择配合部门"
:defaultExpandLevel="2"
:defaultExpandLevel="1"
:normalizer="
(d) => {
return {
id: d.name,
id: d.id,
label: d.name,
children: (d.children&&d.children.length>0)?d.children:undefined,
};

+ 5
- 1
src/views/basicTable/category.vue View File

@@ -256,6 +256,8 @@ export default {
this.loading = fa;
se;
this.$message.error("删失败");
}).finally(()=>{
this.getDataList();
});
})
.catch(() => 0);
@@ -271,6 +273,8 @@ export default {
.catch(() => {
this.loading = false;
this.$message.error("删除失败");
}).finally(()=>{
this.getDataList();
});
}
},
@@ -286,7 +290,7 @@ export default {
type: "success",
message: this.form.id ? "修改成功" : "添加成功",
});
this.getDataList(this.page);
this.getDataList();
})
.catch(() => {
this.loading = false;

+ 6
- 11
src/views/basicTable/conventional.vue View File

@@ -13,15 +13,9 @@
border
:data="dataList"
:height="tableHeight"
:sort-by="['year', 'code', 'quota1']"
:span-method="arraySpanMethod"
v-loading="loading"
:span-method="arraySpanMethod"
>
<el-table-column
type="selection"
width="50"
align="center"
></el-table-column>
<el-table-column
type="index"
label="序号"
@@ -161,7 +155,7 @@
<script>
import search from "./search";
import api from "@/api/basicTable/conventionl.js";
import {base} from "@/utils/mixin";
import { base } from "@/utils/mixin";
export default {
components: {
search,
@@ -197,8 +191,8 @@ export default {
this.getDataList();
},
methods: {
updateParams(data){
this.searchParams=data;
updateParams(data) {
this.searchParams = data;
this.resetCurrentPage();
this.getDataList();
},
@@ -210,7 +204,7 @@ export default {
getDataList() {
this.loading = true;
api
.getList(Object.assign({},this.searchParams,this.page))
.getList(Object.assign({}, this.searchParams, this.page))
.then((res) => {
this.loading = false;
let data = res.data.data.records;
@@ -218,6 +212,7 @@ export default {
item.year = item.year + "";
return item;
});

this.dataList = this.reduceData(data);
this.count = res.data.data.total;
})

Loading…
Cancel
Save