YF-yuan 3 лет назад
Родитель
Сommit
553ef4516c
11 измененных файлов: 243 добавлений и 117 удалений
  1. +3
    -0
      src/api/assessingTarget/basicTarget.js
  2. +3
    -1
      src/api/assessingTarget/constraint.js
  3. +3
    -0
      src/api/assessingTarget/reward.js
  4. +4
    -1
      src/store/getters.js
  5. +10
    -7
      src/store/modules/base.js
  6. +40
    -36
      src/utils/mixin.js
  7. +81
    -45
      src/views/assessingTarget/basicTarget.vue
  8. +81
    -8
      src/views/assessingTarget/reward.vue
  9. +7
    -7
      src/views/assessingTarget/search.vue
  10. +5
    -1
      src/views/basicTable/category.vue
  11. +6
    -11
      src/views/basicTable/conventional.vue

+ 3
- 0
src/api/assessingTarget/basicTarget.js Просмотреть файл

@@ -6,5 +6,8 @@ export default{
},
updatePoints(params){
return axios.post('/basictask/updateExpectedPoints',params)
},
updateLeaderDept(params){
return axios.post('/basictask/updateLeaderDept',params)
}
}

+ 3
- 1
src/api/assessingTarget/constraint.js Просмотреть файл

@@ -1,10 +1,12 @@
import axios from "@/config/axios"
export default {
getList(params) {
console.log(params)
return axios.get("/rigidityconstraint/index", { params })
},
updatePoints(params) {
return axios.post('/rigidityconstraint/updateExpectedPoints', params)
},
updateLeaderDept(params) {
return axios.post('/rigidityconstraint/updateLeaderDept', params)
}
}

+ 3
- 0
src/api/assessingTarget/reward.js Просмотреть файл

@@ -6,5 +6,8 @@ export default {
},
updatePoints(params) {
return axios.post('/specialpower/updateExpectedPoints', params)
},
updateLeaderDept(params) {
return axios.post('/specialpower/updateLeaderDept', params)
}
}

+ 4
- 1
src/store/getters.js Просмотреть файл

@@ -1,7 +1,10 @@


export default {
theme: state => state.theme,
user: state => state.user,
quota1:state=>state.base.quota1,
quota2:state=>state.base.quota2,
department:state=>state.base.department
department:state=>state.base.department,
formatDep:state=>state.base.formatDep
}

+ 10
- 7
src/store/modules/base.js Просмотреть файл

@@ -17,9 +17,10 @@ function formatDet(data) {
export default {
namespaced: true,
state: {
department: [],
formatDep: [],
quota1: [],
quota2: []
quota2: [],
department:[],
},
mutations: {
SET_DEPARTMENT(state, data) {
@@ -30,23 +31,25 @@ export default {
},
SET_QUOTAL2(state, data) {
state.quota2 = data;
},
SET_FORMATDEP(state,data){
console.log(data)
state.formatDep=data;
}
},
actions: {
getDepartment({ commit, state }, data) {
return new Promise((resolve, reject) => {
if (state.department.length > 0) {
resolve(state.department)
return;
} else {
axios.get('dept/getDeptList/' + data).then(res => {
let data = res.data.data;
console.log(formatDet(data));
commit('SET_DEPARTMENT',formatDet(data));
return formatDet(data);
commit('SET_DEPARTMENT',data);
commit('SET_FORMATDEP',formatDet(data))
}).catch(()=>{
commit('SET_DEPARTMENT',[]);
return []
commit('SET_FORMATDEP',[]);
})
}
})

+ 40
- 36
src/utils/mixin.js Просмотреть файл

@@ -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 = {
}
}
}
}
},
}

+ 81
- 45
src/views/assessingTarget/basicTarget.vue Просмотреть файл

@@ -60,42 +60,9 @@
align="center"
prop="leaderUnit"
></el-table-column>
<el-table-column
label="牵头部门"
min-width="150"
align="center"
prop="leaderDept"
>
<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>
<el-table-column label="牵头部门" min-width="150" align="center">
<template slot-scope="{ row }">
<span>{{ row.leaderDeptList | formatList }}</span>
</template>
</el-table-column>
<el-table-column
@@ -103,13 +70,27 @@
min-width="80"
align="center"
prop="leaderPrincipal"
></el-table-column>
>
<template slot-scope="{ row }">
{{ row.leaderPrincipalList | formatList }}
</template>
</el-table-column>
<el-table-column
label="备注"
align="center"
min-width="150"
prop="note"
></el-table-column>
<el-table-column label="操作" min-width="100" align="center">
<template slot-scope="{ row }">
<el-button
type="warning"
size="small"
@click="showLeaderDept(row)"
>设置牵头部门</el-button
>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page.sync="page.page"
@@ -119,8 +100,42 @@
layout="total, prev, pager, next, jumper"
:pager-count="5"
class="ele-pagination-circle"
:flat="true"
@current-change="getDataList()"
/>

<el-dialog
title="设置牵头部门"
:visible.sync="showDep"
width="400px"
custom-class="ele-dialog-form"
:lock-scroll="false"
:destroy-on-class="true"
>
<treeselect
v-model="updateData.leaderDept"
:options="formatDep"
:multiple="true"
placeholder="请选择牵头部门"
:defaultExpandLevel="1"
:normalizer="
(d) => {
return {
id: d.id,
label: d.name,
children:
d.children && d.children.length > 0 ? d.children : undefined,
};
}
"
/>
<div slot="footer">
<el-button @click="showDep = false">取消</el-button>&nbsp;
<el-button type="primary" @click="updateLeaderDept"
>保存</el-button
>
</div>
</el-dialog>
</el-card>
</div>
</template>
@@ -128,7 +143,6 @@
<script>
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";
@@ -158,16 +172,43 @@ export default {
quota1: "",
quota2: "",
},
<<<<<<< HEAD
class:{type:0}
=======
updateData: [],
showDep: false,
>>>>>>> 279c27f4171c882a90872dbed98b219a3783bec7
};
},
created() {
this.getDataList();
},
computed: {
...mapGetters(["department"]),
...mapGetters(["formatDep"]),
},
filters: {
formatList(val) {
if (val) {
return val.join(",");
}
},
},
methods: {
updateLeaderDept(){
api.updateLeaderDept({itemId:this.updateData.id,leaderDept:this.updateData.leaderDept}).then(()=>{
this.$message({type:"success",message:"设置牵头部门成功"})
}).catch(()=>{
this.$message.error('设置牵头部门失败')
}).finally(()=>{
this.getDataList();
})
},
showLeaderDept(data) {
this.showDep = true;
console.log(data)
data.leaderDept=(data.leaderDept&&data.leaderDept.split(','))||[];
this.updateData = data
},
updateParams(data) {
this.searchParams = data;
this.resetCurrentPage();
@@ -204,11 +245,6 @@ export default {
data[index].focus = bool;
this.dataList = data;
},
showDep(index, bool) {
let data = this.dataList;
data[index].selectFocus = bool;
this.dataList = data;
},
getDataList() {
this.loading = true;
api
@@ -235,5 +271,5 @@ export default {
};
</script>

<style>
<style scoped>
</style>

+ 81
- 8
src/views/assessingTarget/reward.vue Просмотреть файл

@@ -60,12 +60,11 @@
align="center"
prop="leaderUnit"
></el-table-column>
<el-table-column
label="牵头部门"
min-width="80"
align="center"
prop="leaderDept"
></el-table-column>
<el-table-column label="牵头部门" min-width="150" align="center">
<template slot-scope="{ row }">
<span>{{ row.leaderDeptList | formatList }}</span>
</template>
</el-table-column>
<el-table-column
label="责任领导"
min-width="80"
@@ -78,6 +77,13 @@
min-width="150"
prop="note"
></el-table-column>
<el-table-column label="操作" min-width="100" align="center">
<template slot-scope="{ row }">
<el-button type="warning" size="small" @click="showLeaderDept(row)"
>设置牵头部门</el-button
>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page.sync="page.page"
@@ -89,6 +95,36 @@
class="ele-pagination-circle"
@current-change="getDataList()"
/>
<el-dialog
title="设置牵头部门"
:visible.sync="showDep"
width="400px"
custom-class="ele-dialog-form"
:lock-scroll="false"
:destroy-on-class="true"
>
<treeselect
v-model="updateData.leaderDept"
:options="formatDep"
:multiple="true"
placeholder="请选择牵头部门"
:defaultExpandLevel="1"
:normalizer="
(d) => {
return {
id: d.id,
label: d.name,
children:
d.children && d.children.length > 0 ? d.children : undefined,
};
}
"
/>
<div slot="footer">
<el-button @click="showDep = false">取消</el-button>&nbsp;
<el-button type="primary" @click="updateLeaderDept">保存</el-button>
</div>
</el-dialog>
</el-card>
</div>
</template>
@@ -97,13 +133,16 @@
import tab from "./tab";
import search from "./search";
import api from "@/api/assessingTarget/reward";
import {assessing} from "@/utils/mixin"
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,
},
mixins:[assessing],
mixins: [assessing],
data() {
return {
dataList: [],
@@ -120,12 +159,46 @@ export default {
quota1: "",
quota2: "",
},
updateData:[],
showDep:false,
};
},
created() {
this.getDataList();
},
computed: {
...mapGetters(["formatDep"]),
},
filters: {
formatList(val) {
if (val) {
return val.join(",");
}
},
},
methods: {
updateLeaderDept() {
api
.updateLeaderDept({
itemId: this.updateData.id,
leaderDept: this.updateData.leaderDept,
})
.then(() => {
this.$message({ type: "success", message: "设置牵头部门成功" });
})
.catch(() => {
this.$message.error("设置牵头部门失败");
})
.finally(() => {
this.getDataList();
});
},
showLeaderDept(data) {
this.showDep = true;
console.log(data);
data.leaderDept = (data.leaderDept && data.leaderDept.split(",")) || [];
this.updateData = data;
},
updateParams(data) {
this.searchParams = data;
this.resetCurrentPage();

+ 7
- 7
src/views/assessingTarget/search.vue Просмотреть файл

@@ -53,13 +53,13 @@
<el-form-item label="牵头部门:">
<treeselect
v-model="searchParams.leaderDept"
:options="department"
:options="formatDep"
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,
};
@@ -70,13 +70,13 @@
<el-form-item label="配合部门:">
<treeselect
v-model="searchParams.cooperateDept"
:options="department"
:options="formatDep"
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,
};
@@ -147,7 +147,7 @@ export default {
},
},
computed: {
...mapGetters(["quota1", "quota2", "department"]),
...mapGetters(["quota1", "quota2", "formatDep"]),
},
watch: {
"searchParams.quota1"(val) {

+ 5
- 1
src/views/basicTable/category.vue Просмотреть файл

@@ -288,6 +288,8 @@ export default {
this.loading = fa;
se;
this.$message.error("删失败");
}).finally(()=>{
this.getDataList();
});
})
.catch(() => 0);
@@ -303,6 +305,8 @@ export default {
.catch(() => {
this.loading = false;
this.$message.error("删除失败");
}).finally(()=>{
this.getDataList();
});
}
},
@@ -318,7 +322,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 Просмотреть файл

@@ -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="序号"
@@ -157,7 +151,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,
@@ -193,8 +187,8 @@ export default {
this.getDataList();
},
methods: {
updateParams(data){
this.searchParams=data;
updateParams(data) {
this.searchParams = data;
this.resetCurrentPage();
this.getDataList();
},
@@ -206,7 +200,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;
console.log(res.data.data.records);
@@ -215,6 +209,7 @@ export default {
item.year = item.year + "";
return item;
});

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

Загрузка…
Отмена
Сохранить