YF-yuan 3 år sedan
förälder
incheckning
773ed29772
10 ändrade filer med 288 tillägg och 60 borttagningar
  1. +1
    -1
      src/api/second/segmentation/basicTable.js
  2. +1
    -1
      src/api/second/segmentation/constraint.js
  3. +1
    -1
      src/api/second/segmentation/reward.js
  4. +1
    -1
      src/router/index.js
  5. +2
    -1
      src/store/getters.js
  6. +20
    -2
      src/store/modules/base.js
  7. +1
    -1
      src/views/second/segmentation/basicTable.vue
  8. +1
    -1
      src/views/second/segmentation/constraint.vue
  9. +254
    -48
      src/views/second/segmentation/contentDetail.vue
  10. +6
    -3
      src/views/second/segmentation/reward.vue

+ 1
- 1
src/api/second/segmentation/basicTable.js Visa fil

@@ -14,6 +14,6 @@ export default {
return axios.get('/basictaskitem/getInfo/'+id)
},
deleteItem(id){
return axios.delete("/basictaskitem/getInfo/"+id)
return axios.delete("/basictaskitem/deleteItem/"+id)
}
}

+ 1
- 1
src/api/second/segmentation/constraint.js Visa fil

@@ -14,6 +14,6 @@ export default {
return axios.get('/rigidityconstraintitem/getInfo/'+id)
},
deleteItem(id){
return axios.delete("/rigidityconstraintitem/getInfo/"+id)
return axios.delete("/rigidityconstraintitem/deleteItem/"+id)
}
}

+ 1
- 1
src/api/second/segmentation/reward.js Visa fil

@@ -14,6 +14,6 @@ export default {
return axios.get('/specialpoweritem/getInfo/'+id)
},
deleteItem(id){
return axios.delete("/specialpoweritem/getInfo/"+id)
return axios.delete("/specialpoweritem/deleteItem/"+id)
}
}

+ 1
- 1
src/router/index.js Visa fil

@@ -60,7 +60,7 @@ const routes = [
meta: {hide: true, title: '分项信息'},
children: [
{
path: '/:id/:type',
path: ':id/:type',
component: () => import('@/views/second/segmentation/contentDetail'),
meta: {title: '分项'},
name:"segmentation",

+ 2
- 1
src/store/getters.js Visa fil

@@ -7,5 +7,6 @@ export default {
quota2: state => state.base.quota2,
department: state => state.base.department,
formatDep: state => state.base.formatDep,
quota: state => state.base.quota
quota: state => state.base.quota,
principalList: state => state.base.principalList,
}

+ 20
- 2
src/store/modules/base.js Visa fil

@@ -22,6 +22,7 @@ export default {
quota2: [],
department: [],
quota: [],
principalList: [],
},
mutations: {
SET_DEPARTMENT(state, data) {
@@ -37,7 +38,10 @@ export default {
state.formatDep = data;
},
SET_QUOTA(state, data) {
state.quota=data;
state.quota = data;
},
SET_PRINCIPAL_LIST(state, data) {
state.principalList = data;
}
},
actions: {
@@ -57,6 +61,21 @@ export default {
}
})
},
getPrincipalList({ commit, state }) {
return new Promise((resolve, reject) => {
if (state.principalList.length > 0) {
return;
} else {
axios.get('/user/getUserList').then(res => {
console.log(res)
let data = res.data.data;
commit('SET_PRINCIPAL_LIST', data);
}).catch(() => {
commit('SET_PRINCIPAL_LIST', []);
})
}
})
},
getQuota1List({ commit }, data) {
return new Promise((resolve) => {
axios.get('/quota/getQuota1List/' + data).then(res => {
@@ -85,7 +104,6 @@ export default {
return new Promise((resolve) => {
axios.get('/rigidityconstraint/getQuotaList').then(res => {
let data = res.data.data;
console.log(data)
commit('SET_QUOTA', data);
resolve(data)
}).catch(() => {

+ 1
- 1
src/views/second/segmentation/basicTable.vue Visa fil

@@ -93,7 +93,7 @@
<el-table-column label="操作" width="80" align="center">
<template slot-scope="{ row }">
<router-link
:to="{ name: 'segmentation', params: { id:row.id, type: 1 } }"
:to="{ name: 'segmentation', params: { id:row.basicTaskId, type: 1 } }"
>分项</router-link
>
</template>

+ 1
- 1
src/views/second/segmentation/constraint.vue Visa fil

@@ -86,7 +86,7 @@
<el-table-column label="操作" width="80" align="center">
<template slot-scope="{ row }">
<router-link
:to="{ name: 'segmentation', params: { id: row.id, type: 3 } }"
:to="{ name: 'segmentation', params: { id: row.rigidityConstraintId, type: 3 } }"
>分项</router-link
>
</template>

+ 254
- 48
src/views/second/segmentation/contentDetail.vue Visa fil

@@ -67,13 +67,17 @@
<div class="segmentation" style="margin-top: 30px">
<div class="title">
<span>分项信息</span>
<el-button type="primary" size="small" style="margin-right: 50px"
<el-button
type="primary"
size="small"
style="margin-right: 50px"
@click="change('add')"
>添加</el-button
>
</div>
<div>
<el-table
:data="dataDetail"
:data="detailList"
border
highlight-current-row
v-loading="tableLoading"
@@ -89,43 +93,83 @@
align="center"
min-width="150"
max-width="200"
></el-table-column>
<el-table-column
label="分值"
align="center"
width="80"
></el-table-column>
>
<template slot-scope="{ row }">
<el-input
type="textarea"
placeholder="请输入小项内容"
v-model="form.itemContent"
v-if="row.edit || row.add"
></el-input>
<span v-else>{{ row.itemContent }}</span>
</template>
</el-table-column>
<el-table-column label="分值" align="center" width="80">
<template slot-scope="{ row }">
<el-input
placeholder="请输入分值"
v-if="row.edit || row.add"
v-model="form.points"
></el-input>
<span v-else>{{ row.points }}</span>
</template>
</el-table-column>
<el-table-column label="牵头部门" align="center" width="180">
<treeselect
:multiple="true"
v-model="dataDetail.leaderDept"
:options="formatDep"
placeholder="请选择牵头部门"
:defaultExpandLevel="1"
:normalizer="
(d) => {
return {
id: d.id,
label: d.name,
children:
d.children && d.children.length > 0
? d.children
: undefined,
};
}
"
/>
<template slot-scope="{ row }">
<treeselect
v-if="row.edit || row.add"
:multiple="true"
v-model="form.leaderDept"
:options="formatDep"
placeholder="请选择牵头部门"
:defaultExpandLevel="1"
:normalizer="
(d) => {
return {
id: d.id,
label: d.name,
children:
d.children && d.children.length > 0
? d.children
: undefined,
};
}
"
/>
<span v-else>{{ row.leaderDeptList | formatList }}</span>
</template>
</el-table-column>
<el-table-column label="责任领导" align="center" width="180">
<template slot-scope="{ row }">
<treeselect
v-if="row.edit || row.add"
:multiple="true"
v-model="form.leaderPrincipal"
:options="principalList"
placeholder="请选择牵头部门责任领导"
:defaultExpandLevel="1"
:normalizer="
(d) => {
return {
id: d.id,
label: d.realname,
children:
d.children && d.children.length > 0
? d.children
: undefined,
};
}
"
/>
<span v-else>{{ row.leaderPrincipalList | formatList }}</span>
</template>
</el-table-column>
<el-table-column
label="责任领导"
align="center"
width="100"
></el-table-column>
<el-table-column label="配合部门" align="center" width="180">
<template>
<template slot-scope="{ row }">
<treeselect
v-if="row.edit || row.add"
:multiple="true"
v-model="dataDetail.cooperateDept"
v-model="form.cooperateDept"
:options="formatDep"
placeholder="请选择配合部门"
:defaultExpandLevel="1"
@@ -142,23 +186,73 @@
}
"
/>
<span v-else>{{ row.cooperateDeptList | formatList }}</span>
</template>
</el-table-column>
<el-table-column
label="责任领导"
align="center"
width="100"
></el-table-column>
<el-table-column label="操作" align="center" width="150">
<template>
<el-button type="primary" size="small">编辑</el-button>
<el-button type="danger" size="small">删除</el-button>
<el-table-column label="责任领导" align="center" width="180">
<template slot-scope="{ row }">
<treeselect
v-if="row.edit || row.add"
:multiple="true"
v-model="form.cooperatePrincipal"
:options="principalList"
placeholder="请选择配合部门责任领导"
:defaultExpandLevel="1"
:normalizer="
(d) => {
return {
id: d.id,
label: d.realname,
children:
d.children && d.children.length > 0
? d.children
: undefined,
};
}
"
/>
<span v-else>{{
row.cooperatePrincipalList | formatList
}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="135">
<template slot-scope="{ row, $index }">
<el-link
v-if="row.add || row.edit"
@click="add(row)"
icon="el-icon-edit"
type="primary"
:underline="false"
>保存</el-link
>
<template v-else>
<el-link
@click="change('edit', $index)"
icon="el-icon-edit"
type="primary"
:underline="false"
>编辑</el-link
>
<el-popconfirm
title="确定要删除此表格?"
@confirm="remove(row.id)"
class="ele-action"
>
<el-link
slot="reference"
icon="el-icon-delete"
type="danger"
:underline="false"
>删除</el-link
>
</el-popconfirm>
</template>
</template>
</el-table-column>
</el-table>
</div>
<div slot="footer" class="footer">
<el-button type="primary" @click="save">确定</el-button>
<el-button @click="close">取消</el-button>&nbsp;
</div>
</div>
@@ -173,6 +267,11 @@ import basicTableApi from "@/api/second/segmentation/basicTable";
import rewardApi from "@/api/second/segmentation/reward";
import constraintApi from "@/api/second/segmentation/constraint";
import { mapGetters } from "vuex";
let map = {
1: "taskItemList",
2: "specialPowerItemList",
3: "rigidityConstraintItemList",
};
export default {
props: {
id: {
@@ -188,16 +287,23 @@ export default {
data() {
return {
data: {},
dataDetail: [],
// dataDetail: {},
allLoading: false,
tableLoading: false,
form: {},
};
},
computed: {
...mapGetters(["formatDep"]),
...mapGetters(["formatDep", "principalList"]),
detailList() {
let that = this;
return this.data[map[this.type]];
},
},
created() {
this.getData();
this.$store.dispatch("base/getDepartment", 1);
this.$store.dispatch("base/getPrincipalList");
},
filters: {
formatList(val) {
@@ -243,12 +349,112 @@ export default {
this.tableLoading = false;
});
},
save() {
this.$router.back(-1);
change(type, index) {
if (type == "add") {
let data = this.data;
data[map[this.type]].push({ add: true });
}
if (type == "edit") {
console.log(this.formatDep, this.principalList);
let form = JSON.parse(JSON.stringify(this.data[map[this.type]][index]));
form.leaderDept = form.leaderDept
.split(",")
.map((item) => parseInt(item));
form.cooperateDept = form.cooperateDept
.split(",")
.map((item) => parseInt(item));
form.leaderPrincipal = form.leaderPrincipal
.split(",")
.map((item) => parseInt(item));
form.cooperatePrincipal = form.cooperatePrincipal
.split(",")
.map((item) => parseInt(item));
this.form = form;
this.$set(this.data[map[this.type]][index], "edit", true);
}
},
close() {
this.$router.back(-1);
},
add(data) {
this.allLoading = true;
let form = this.form;
form.cooperateDept = form.cooperateDept && form.cooperateDept.join(",");
form.leaderDept = form.leaderDept && form.leaderDept.join(",");
form.leaderPrincipal =
form.leaderPrincipal && form.leaderPrincipal.join(",");
form.cooperatePrincipal =
form.cooperatePrincipal && form.cooperatePrincipal.join(",");
if (data.edit) {
this.getApi()
.editItem(form)
.then((res) => {
this.$message({
type: "success",
message: "修改小项内容成功",
});
this.getData();
})
.catch((e) => {
this.$message.error("修改小项内容失败");
})
.finally(() => {
this.allLoading = false;
this.form = {};
});
}
if (data.add) {
let obj = {};
switch (parseInt(this.type)) {
case 1:
obj["basicTaskId"] = this.id;
break;
case 2:
obj["specialPowerId"] = this.id;
break;
case 3:
obj["rigidityConstraintId"] = this.id;
break;
}
this.getApi()
.addItem(Object.assign({}, form, obj))
.then((res) => {
console.log(res.data.code);
if (res.data.code === 0) {
this.$message({
type: "success",
message: "添加小项内容成功",
});
} else {
this.$message.error("添加小项内容失败");
}
this.getData();
})
.catch((e) => {
this.$message.error("添加小项内容失败");
})
.finally(() => {
this.allLoading = false;
this.form = {};
});
}
},
remove(id) {
this.allLoading = true;
this.getApi()
.deleteItem(id)
.then((res) => {
this.$message({ type: "success", message: "删除小项成功" });
this.getData();
})
.catch((e) => {
console.log(e);
this.$message.error("删除小项失败");
})
.finally(() => {
this.allLoading = false;
});
},
},
};
</script>

+ 6
- 3
src/views/second/segmentation/reward.vue Visa fil

@@ -5,7 +5,7 @@
v-loading="loading"
element-loading-background="rgba(255, 255, 255, 1)"
>
<search :type="1" @search:task="updateParams($event)" />
<search :type="2" @search:task="updateParams($event)" />
<div class="operating">
<el-button size="small" type="primary">导出</el-button>
</div>
@@ -17,7 +17,7 @@
:span-method="arraySpanMethod"
ref="table"
>
<el-table-column
<el-table-column
type="index"
width="50"
align="center"
@@ -93,7 +93,10 @@
<el-table-column label="操作" width="125" align="center">
<template slot-scope="{ row }">
<router-link
:to="{ name: 'segmentation', params: { id: row.id, type: 2 } }"
:to="{
name: 'segmentation',
params: { id: row.specialPowerId, type: 2 },
}"
>分项</router-link
>
</template>

Laddar…
Avbryt
Spara