yangzhou-cyber 3 роки тому
джерело
коміт
cd920e30b8
9 змінених файлів з 447 додано та 142 видалено
  1. +2
    -1
      src/store/getters.js
  2. +35
    -15
      src/store/modules/base.js
  3. +147
    -44
      src/utils/mixin.js
  4. +100
    -29
      src/views/assessingTarget/basicTarget.vue
  5. +21
    -4
      src/views/assessingTarget/constraint.vue
  6. +27
    -4
      src/views/assessingTarget/reward.vue
  7. +58
    -19
      src/views/assessingTarget/search.vue
  8. +33
    -17
      src/views/basicTable/category.vue
  9. +24
    -9
      src/views/basicTable/conventional.vue

+ 2
- 1
src/store/getters.js Переглянути файл

@@ -2,5 +2,6 @@ export default {
theme: state => state.theme,
user: state => state.user,
quota1:state=>state.base.quota1,
quota2:state=>state.base.quota2
quota2:state=>state.base.quota2,
department:state=>state.base.department
}

+ 35
- 15
src/store/modules/base.js Переглянути файл

@@ -1,4 +1,19 @@
import axios from "axios"

function formatDet(data) {
console.log
let format = function (pid) {
let arr = [];
data.forEach(item => {
if (item.pid == pid) {
item.children = format(item.id);
arr.push(item)
}
})
return arr;
}
return format(0)
}
export default {
namespaced: true,
state: {
@@ -18,39 +33,44 @@ export default {
}
},
actions: {
getDepartment({ commit, state }) {
console.log('===========')
getDepartment({ commit, state }, data) {
return new Promise((resolve, reject) => {
if (state.department.length > 0) {
resolve(state.department)
return;
} else {
axios.get('dept/getDeptList').then(res=>{
console.log(res)
axios.get('dept/getDeptList/' + data).then(res => {
let data = res.data.data;
console.log(formatDet(data));
commit('SET_DEPARTMENT',formatDet(data));
return formatDet(data);
}).catch(()=>{
commit('SET_DEPARTMENT',[]);
return []
})
}
})
},
getQuota1List({ commit }, data) {
return new Promise((resolve) => {
axios.get('/quota/getQuota1List/'+data).then(res=>{
let data=res.data.data;
commit('SET_QUOTAL1',data);
axios.get('/quota/getQuota1List/' + data).then(res => {
let data = res.data.data;
commit('SET_QUOTAL1', data);
resolve(data)
}).catch(()=>{
commit('SET_QUOTAL1',[])
}).catch(() => {
commit('SET_QUOTAL1', [])
resolve([]);
})
})
},
getQuota2List({ commit}, data) {
getQuota2List({ commit }, data) {
return new Promise((resolve) => {
axios.get('/quota/getQuota2List/'+data).then(res=>{
let data=res.data.data;
commit('SET_QUOTAL2',data);
axios.get('/quota/getQuota2List/' + data).then(res => {
let data = res.data.data;
commit('SET_QUOTAL2', data);
resolve(data)
}).catch(()=>{
commit('SET_QUOTAL2',[])
}).catch(() => {
commit('SET_QUOTAL2', [])
resolve([]);
})
})

+ 147
- 44
src/utils/mixin.js Переглянути файл

@@ -1,70 +1,173 @@
export default{
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
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;
item.codeRow=arr.filter(child=>{
return child.year==item.year&&child.code==item.code
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;
})
},
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex == 2) {
if (row.yearRow) {
return {
rowspan: row.yearRow,
colspan: 1
}
} else {
return {
rowspan: 0,
colspan: 1
}
}
}
if (columnIndex == 3 || columnIndex == 4) {
if (row.codeRow) {
return {
rowspan: row.codeRow,
colspan: 1
}
} else {
return {
rowspan: 0,
colspan: 1
}
}
}
if (columnIndex == 5) {
if (row.quota1Row) {
return {
rowspan: row.quota1Row,
colspan: 1
}
} else {
return {
rowspan: 0,
colspan: 1
}
}
}
}
},
}


export let assessing = {
methods: {
reduceData(data) {
let arr = data;
let quota1, quota2;
return arr.map(item => {
if (item.quota2 != quota2 && (quota1 == undefined || quota1 == item.quota1)) {
quota2 = item.quota2;
item.quota2Row = arr.filter(child => {
return child.quota1 == item.quota1 && child.quota2 == item.quota2
}).length
}
if(item.year!=year){
year=item.year;
item.yearRow=arr.filter(child=>{
return child.year==item.year

if (item.quota1 != quota1) {
quota1 = item.quota1;
quota2 = item.quota2;
item.quota2Row = arr.filter(child => {
return child.quota1 == item.quota1 && child.quota2 == item.quota2
}).length
item.quota1Row = arr.filter(child => {
return child.quota1 == item.quota1
}).length;
}
return item;
})
},
arraySpanMethod({row,column,rowIndex,columnIndex}){
if(columnIndex==2){
if(row.yearRow){
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex == 1) {
if (row.quota1Row) {
return {
rowspan:row.yearRow,
colspan:1
rowspan: row.quota1Row,
colspan: 1
}
}else{
return{
rowspan:0,
colspan:1
} else {
return {
rowspan: 0,
colspan: 1
}
}
}
if(columnIndex==3||columnIndex==4){
if(row.codeRow){
if (columnIndex == 2) {
if (row.quota2Row) {
return {
rowspan:row.codeRow,
colspan:1
rowspan: row.quota2Row,
colspan: 1
}
}else{
return{
rowspan:0,
colspan:1
} else {
return {
rowspan: 0,
colspan: 1
}
}
}
if(columnIndex==5){
if(row.quota1Row){
}
},
}

export let quota = {
methods: {
reduceData(data) {
let arr = data;
let quota;
return arr.map(item => {
if (item.quota != quota) {
quota = item.quota;
item.quotaRow = arr.filter(child => {
return child.quota == item.quota
}).length
}

return item;
})
},
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex == 1) {
if (row.quotaRow) {
return {
rowspan:row.quota1Row,
colspan:1
rowspan: row.quotaRow,
colspan: 1
}
}else{
return{
rowspan:0,
colspan:1
} else {
return {
rowspan: 0,
colspan: 1
}
}
}
}
},
}
}


+ 100
- 29
src/views/assessingTarget/basicTarget.vue Переглянути файл

@@ -2,13 +2,14 @@
<div class="basic-target ele-body">
<el-card shadow="never">
<tab />
<search :type="1" @search:task="getDataList($event)"/>
<search :type="1" @search:task="updateParams($event)" />
<el-table
:data="dataList"
border
highlight-current-row
:height="tableHeight"
v-loading="loading"
:span-method="arraySpanMethod"
>
<el-table-column type="index" label="序号" align="center">
</el-table-column>
@@ -38,15 +39,18 @@
align="center"
prop="points"
></el-table-column>
<el-table-column
label="预计扣分"
min-width="60"
align="center"
>
<template slot-scope="{row,$index}">
<div @dblclick="showText($index,true)" style="height:100%">
<el-input v-model="row.expectedPoints" v-if="row.focus" @blur="showText($index,false);updatePoints(row)"></el-input>
<span v-else>{{row.expectedPoints}}</span>
<el-table-column label="预计扣分" min-width="60" align="center">
<template slot-scope="{ row, $index }">
<div @dblclick="showText($index, true)" style="height: 100%">
<el-input
v-model="row.expectedPoints"
v-if="row.focus"
@blur="
showText($index, false);
updatePoints(row);
"
></el-input>
<span v-else>{{ row.expectedPoints }}</span>
</div>
</template>
</el-table-column>
@@ -58,10 +62,42 @@
></el-table-column>
<el-table-column
label="牵头部门"
min-width="80"
min-width="150"
align="center"
prop="leaderDept"
></el-table-column>
>
<template slot-scope="{ row, $index }">
<div
@dblclick="showDep($index, true)"
style="height: 45px;width:100%"
>
<treeselect
@blur="
showSelect($index, false);
updateDep(row);
"
v-if="row.selectFocus"
v-model="row.leaderDept"
:options="department"
placeholder="请选择牵头部门"
:defaultExpandLevel="2"
:normalizer="
(d) => {
return {
id: d.name,
label: d.name,
children:
d.children && d.children.length > 0
? d.children
: undefined,
};
}
"
/>
<span v-else>{{ row.leaderDept }}</span>
</div>
</template>
</el-table-column>
<el-table-column
label="责任领导"
min-width="80"
@@ -94,57 +130,92 @@ import tab from "./tab";
import search from "./search";
import taskTable from "./taskTable";
import api from "@/api/assessingTarget/basicTarget";
import { assessing } from "@/utils/mixin";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Treeselect from "@riophae/vue-treeselect"; // 下拉树
import { mapGetters } from "vuex";
export default {
components: {
tab,
search,
taskTable,
Treeselect,
},
mixins: [assessing],
data() {
return {
dataList: [],
loading: false,
count: 0,
tableHeight:document.documentElement.clientHeight - 470,
tableHeight: document.documentElement.clientHeight - 470,
page: {
page: 1,
limit: Math.floor(
(document.documentElement.clientHeight - 470 - 45) / 45
),
},
searchParams: {
quota1: "",
quota2: "",
},
};
},
created() {
this.getDataList();
},
computed: {
...mapGetters(["department"]),
},
methods: {
updatePoints(row){
api.updatePoints({basicTaskId:row.id,expectedPoints:row.expectedPoints}).then(res=>{
this.$message({type:"success",message:"修改成功"});
}).catch(()=>{
this.$message.error("修改失败");
this.getDataList();
})
updateParams(data) {
this.searchParams = data;
this.resetCurrentPage();
this.getDataList();
},
resetCurrentPage() {
let page = this.page;
page.page = 1;
this.page = page;
},
updatePoints(row) {
api
.updatePoints({
basicTaskId: row.id,
expectedPoints: row.expectedPoints,
})
.then((res) => {
this.$message({ type: "success", message: "修改成功" });
})
.catch(() => {
this.$message.error("修改失败");
this.getDataList();
});
},
showText(index, bool) {
console.log(index);
let data = this.dataList;
data[index].focus = bool;
this.dataList = data;
},
showText(index,bool){
console.log(index)
let data=this.dataList;
data[index].focus=bool;
this.dataList=data;
showDep(index, bool) {
let data = this.dataList;
data[index].selectFocus = bool;
this.dataList = data;
},
getDataList(params) {
getDataList() {
this.loading = true;
api
.getList(params ? Object.assign(this.page, params) : this.page)
.getList(Object.assign({}, this.searchParams, this.page))
.then((res) => {
this.loading = false;
let data = res.data.data.records;
data = data.map((item) => {
item.year = item.year + "";
item.focus=false;
item.focus = false;
item.selectFocus = false;
return item;
});
this.dataList = data;
this.dataList = this.reduceData(data);
this.count = res.data.data.total;
})
.catch(() => {

+ 21
- 4
src/views/assessingTarget/constraint.vue Переглянути файл

@@ -2,13 +2,14 @@
<div class="reward ele-body">
<el-card shadow="never">
<tab />
<search :type="3" @search:task="getDataList($event)" />
<search :type="3" @search:task="updateParams($event)" />
<el-table
:data="dataList"
border
highlight-current-row
:height="tableHeight"
v-loading="loading"
:span-method="arraySpanMethod"
>
<el-table-column type="index" label="序号" align="center">
</el-table-column>
@@ -82,11 +83,13 @@
import tab from "./tab";
import search from "./search";
import api from "@/api/assessingTarget/constraint";
import { quota } from "@/utils/mixin";
export default {
components: {
tab,
search,
},
mixins: [quota],
data() {
return {
dataList: [],
@@ -99,12 +102,26 @@ export default {
(document.documentElement.clientHeight - 470 - 45) / 45
),
},
searchParams: {
quota1: "",
quota2: "",
},
};
},
created() {
this.getDataList();
},
methods: {
updateParams(data) {
this.searchParams = data;
this.resetCurrentPage();
this.getDataList();
},
resetCurrentPage() {
let page = this.page;
page.page = 1;
this.page = page;
},
updatePoints(row) {
api
.updatePoints({
@@ -125,10 +142,10 @@ export default {
data[index].focus = bool;
this.dataList = data;
},
getDataList(params) {
getDataList() {
this.loading = true;
api
.getList(params ? Object.assign(this.page, params) : this.page)
.getList(Object.assign({}, this.searchParams, this.page))
.then((res) => {
this.loading = false;
let data = res.data.data.records;
@@ -137,7 +154,7 @@ export default {
item.focus = false;
return item;
});
this.dataList = data;
this.dataList = this.reduceData(data);
this.count = res.data.data.total;
})
.catch(() => {

+ 27
- 4
src/views/assessingTarget/reward.vue Переглянути файл

@@ -2,13 +2,14 @@
<div class="reward ele-body">
<el-card shadow="never">
<tab />
<search :type="2" @search:task="getDataList($event)" />
<search :type="2" @search:task="updateParams($event)" />
<el-table
:data="dataList"
border
highlight-current-row
:height="tableHeight"
v-loading="loading"
:span-method="arraySpanMethod"
>
<el-table-column type="index" label="序号" align="center">
</el-table-column>
@@ -26,6 +27,12 @@
prop="quota2"
></el-table-column>
</template>
<el-table-column
label="考核指标"
min-width="150"
align="center"
prop=""
></el-table-column>
<el-table-column
label="封顶分值"
min-width="60"
@@ -82,7 +89,6 @@
class="ele-pagination-circle"
@current-change="getDataList()"
/>
F
</el-card>
</div>
</template>
@@ -91,11 +97,13 @@
import tab from "./tab";
import search from "./search";
import api from "@/api/assessingTarget/reward";
import {assessing} from "@/utils/mixin"
export default {
components: {
tab,
search,
},
mixins:[assessing],
data() {
return {
dataList: [],
@@ -108,12 +116,26 @@ export default {
(document.documentElement.clientHeight - 470 - 45) / 45
),
},
searchParams: {
quota1: "",
quota2: "",
},
};
},
created() {
this.getDataList();
},
methods: {
updateParams(data) {
this.searchParams = data;
this.resetCurrentPage();
this.getDataList();
},
resetCurrentPage() {
let page = this.page;
page.page = 1;
this.page = page;
},
updatePoints(row) {
api
.updatePoints({
@@ -137,7 +159,7 @@ export default {
getDataList(params) {
this.loading = true;
api
.getList(params ? Object.assign(this.page, params) : this.page)
.getList(Object.assign({}, this.searchParams, this.page))
.then((res) => {
this.loading = false;
let data = res.data.data.records;
@@ -146,7 +168,8 @@ export default {
item.focus = false;
return item;
});
this.dataList = data;
this.dataList = this.reduceData(data);
// this.dataList = data;
this.count = res.data.data.total;
})
.catch(() => {

+ 58
- 19
src/views/assessingTarget/search.vue Переглянути файл

@@ -50,25 +50,59 @@
></el-input>
</el-form-item>
</template>
<!-- <el-form-item label="牵头部门:">
<el-select filterabel clearable v-model="searchParams.leaderDept">
<el-option></el-option>
</el-select>
<el-form-item label="牵头部门:">
<treeselect
v-model="searchParams.leaderDept"
:options="department"
placeholder="请选择牵头部门"
:defaultExpandLevel="2"
:normalizer="
(d) => {
return {
id: d.name,
label: d.name,
children: (d.children&&d.children.length>0)?d.children:undefined,
};
}
"
/>
</el-form-item>
<el-form-item label="配合部门:">
<el-select filterable clearable>
<el-option></el-option>
</el-select>
</el-form-item> -->
<treeselect
v-model="searchParams.cooperateDept"
:options="department"
placeholder="请选择配合部门"
:defaultExpandLevel="2"
:normalizer="
(d) => {
return {
id: d.name,
label: d.name,
children: (d.children&&d.children.length>0)?d.children:undefined,
};
}
"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="search">查询</el-button>
<el-button type="default" size="small" @click="clear();search()">清空</el-button>
<el-button
type="default"
size="small"
@click="
clear();
search();
"
>清空</el-button
>
</el-form-item>
</el-form>
</div>
</template>

<script>
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Treeselect from "@riophae/vue-treeselect"; // 下拉树
import { mapGetters, mapActions } from "vuex";
export default {
props: {
@@ -79,17 +113,22 @@ export default {
},
},
},
components: {
Treeselect,
},
data() {
return {
searchParams: {
quota1: "",
quota2: "",
leaderDept: undefined,
cooperateDept: undefined,
},
};
},
created() {
this.getQuota1List(this.type);
this.getDepartment();
this.getDepartment(1);
},
methods: {
...mapActions({
@@ -97,18 +136,18 @@ export default {
getQuota2List: "base/getQuota2List",
getDepartment: "base/getDepartment",
}),
clear(){
this.searchParams={
quota1:'',
quota2:""
}
clear() {
this.searchParams = {
quota1: "",
quota2: "",
};
},
search() {
this.$emit("search:task", this.searchParams);
},
search(){
this.$emit("search:task",this.searchParams);
}
},
computed: {
...mapGetters(["quota1", "quota2"]),
...mapGetters(["quota1", "quota2", "department"]),
},
watch: {
"searchParams.quota1"(val) {

+ 33
- 17
src/views/basicTable/category.vue Переглянути файл

@@ -1,7 +1,7 @@
<template>
<div class="category ele-body">
<el-card shadow="never">
<search @search="getDataList($event)"/>
<search @search="updateParams($event)" />
<div class="operating">
<el-button size="small" type="warning" @click="add">新增</el-button>
<el-button size="small" type="default" @click="remove()"
@@ -165,7 +165,7 @@ export default {
data() {
return {
// searchParams: {},
loading:false,
loading: false,
dataList: [],
count: 0,
page: {
@@ -183,22 +183,37 @@ export default {
name: [{ required: true, message: "请输入表格名称", trigger: "blur" }],
year: [{ required: true, message: "请输入考核年度", trigger: "blur" }],
},
searchParams: {
year: "",
code: "",
name: "",
},
};
},
created() {
this.getDataList();
this.$store.dispatch('base/getQuota1List',1)
this.$store.dispatch("base/getQuota1List", 1);
},
methods: {
updateParams(data){
this.searchParams=data;
this.resetCurrentPage();
this.getDataList();
},
resetCurrentPage() {
let page = this.page;
page.page = 1;
this.page = page;
},
selectionChange(rows) {
this.multipleSelection = rows;
},
getDataList(params) {
this.loading=true
getDataList() {
this.loading = true;
api
.getList(params ? Object.assign(this.page, params) : this.page)
.getList(Object.assign({},this.searchParams,this.page))
.then((res) => {
this.loading=false
this.loading = false;
let data = res.data.data.records;
data = data.map((item) => {
item.year = item.year + "";
@@ -208,7 +223,7 @@ export default {
this.count = res.data.data.total;
})
.catch(() => {
this.loading=false
this.loading = false;
this.dataList = [];
this.count = 0;
});
@@ -230,30 +245,31 @@ export default {
ids.join(",");
this.$confirm("确定要删除选中表格?", "提示", { type: "warning" })
.then(() => {
this.loading=true
this.loading = true;
api
.delete(ids)
.then(() => {
this.loading=false
this.loading = false;
this.$message({ type: "success", message: "删除成功" });
})
.catch(() => {
this.loading=fa;se
this.loading = fa;
se;
this.$message.error("删失败");
});
})
.catch(() => 0);
} else {
// 单个删除
this.loading=true;
this.loading = true;
api
.delete(row.id)
.then(() => {
this.loading=false
this.loading = false;
this.$message({ type: "success", message: "删除成功" });
})
.catch(() => {
this.loading=false
this.loading = false;
this.$message.error("删除失败");
});
}
@@ -261,11 +277,11 @@ export default {
save() {
this.$refs["editForm"].validate((valid) => {
if (valid) {
this.loading=true;
this.loading = true;
let action = this.form.id ? "edit" : "add";
api[action](this.form)
.then(() => {
this.loading=false
this.loading = false;
this.$message({
type: "success",
message: this.form.id ? "修改成功" : "添加成功",
@@ -273,7 +289,7 @@ export default {
this.getDataList(this.page);
})
.catch(() => {
this.loading=false
this.loading = false;
this.$message.error(this.form.id ? "修改失败" : "添加失败");
})
.finally(() => {

+ 24
- 9
src/views/basicTable/conventional.vue Переглянути файл

@@ -1,7 +1,7 @@
<template>
<div class="conventional ele-body">
<el-card shadow="never">
<search @search="getDataList($event)"/>
<search @search="updateParams($event)" />
<!-- <div class="operating">
<el-button size="small" type="warning" @click="add">新增</el-button>
<el-button size="small" type="default">批量删除</el-button>
@@ -13,7 +13,7 @@
border
:data="dataList"
:height="tableHeight"
:sort-by="['year','code','quota1']"
:sort-by="['year', 'code', 'quota1']"
:span-method="arraySpanMethod"
v-loading="loading"
>
@@ -161,12 +161,12 @@
<script>
import search from "./search";
import api from "@/api/basicTable/conventionl.js";
import mixin from "@/utils/mixin";
import {base} from "@/utils/mixin";
export default {
components: {
search,
},
mixins: [mixin],
mixins: [base],
data() {
return {
dataList: [],
@@ -186,18 +186,33 @@ export default {
name: [{ required: true, message: "请输入表格名称", trigger: "blur" }],
year: [{ required: true, message: "请输入考核年度" }],
},
searchParams: {
year: "",
code: "",
name: "",
},
};
},
created() {
this.getDataList();
},
methods: {
getDataList(params) {
this.loading=true;
updateParams(data){
this.searchParams=data;
this.resetCurrentPage();
this.getDataList();
},
resetCurrentPage() {
let page = this.page;
page.page = 1;
this.page = page;
},
getDataList() {
this.loading = true;
api
.getList(params ? Object.assign(this.page, params) : this.page)
.getList(Object.assign({},this.searchParams,this.page))
.then((res) => {
this.loading=false;
this.loading = false;
let data = res.data.data.records;
data = data.map((item) => {
item.year = item.year + "";
@@ -207,7 +222,7 @@ export default {
this.count = res.data.data.total;
})
.catch(() => {
this.loading=false
this.loading = false;
this.dataList = [];
this.count = 0;
});

Завантаження…
Відмінити
Зберегти