岗位任务bug修复

This commit is contained in:
zxy
2024-03-01 11:28:35 +08:00
parent df5f642136
commit 63ab28f014
2 changed files with 117 additions and 106 deletions

View File

@@ -50,7 +50,7 @@
></select-map> ></select-map>
</template> </template>
<!-- 行业类型 --> <!-- 行业类型 -->
<template slot="tradeId"> <!-- <template slot="tradeId">
<div class="tradeId"> <div class="tradeId">
<el-autocomplete <el-autocomplete
popper-class="my-autocomplete" popper-class="my-autocomplete"
@@ -66,7 +66,7 @@
</template> </template>
</el-autocomplete> </el-autocomplete>
</div> </div>
</template> </template> -->
<!-- 工种 --> <!-- 工种 -->
<template slot="worktypeIds"> <template slot="worktypeIds">
<div class="tradeId"> <div class="tradeId">
@@ -462,21 +462,24 @@ export default {
{ {
label: "行业类型", label: "行业类型",
prop: "tradeId", prop: "tradeId",
formslot: true, type: "select",
labelslot: false, dicData: this.tradeData,
errorslot: false, props: {
label: "name",
value: "id",
},
rules: [ rules: [
{ {
required: true, required: true,
validator: tradeId, // validator: tradeId,
trigger: ["change", "blur"], trigger: "blur",
}, },
], ],
span: 12, span: 12,
}, },
{ {
label: "工种", label: "工种",
prop: "skillIds", prop: "workSkills",
type: "cascader", type: "cascader",
search: true, search: true,
display: true, display: true,
@@ -967,21 +970,19 @@ export default {
}); });
}else{ }else{
row.address = this.$refs.selectMap.addressLocation; row.address = this.$refs.selectMap.addressLocation;
let ids = []; // let ids = [];
let name = []; // let name = [];
this.selectedSkills.forEach((ele) => { // this.selectedSkills.forEach((ele) => {
ids.push(ele.id); // ids.push(ele.id);
name.push(ele.name); // name.push(ele.name);
}); // });
if(this.skillArr && this.skillArr.length > 0) { if(this.skillArr && this.skillArr.length > 0) {
this.skillArr.forEach(item => { this.skillArr.forEach(item => {
if(item.id == row.skillIds[0]) { if(item.id == row.workSkills[0]) {
console.log(row.skillIds[0])
row.worktypeNames = item.name row.worktypeNames = item.name
if(item.child && item.child.length > 0) { if(item.child && item.child.length > 0) {
item.child.forEach(item2 => { item.child.forEach(item2 => {
if(item2.id == row.skillIds[1]) { if(item2.id == row.workSkills[1]) {
console.log(row.skillIds[1])
row.skillNames = item2.name; row.skillNames = item2.name;
} }
}) })
@@ -989,6 +990,16 @@ export default {
} }
}) })
} }
if(this.tradeData && this.tradeData.length > 0) {
this.tradeData.forEach(item => {
if(row.tradeId == item.id) {
row.tradeNames = item.name
}
})
}
if (this.type === "add" || this.type === "copy") { if (this.type === "add" || this.type === "copy") {
this.$jlEvent("trialCheck") this.$jlEvent("trialCheck")
.then(() => { .then(() => {
@@ -1002,10 +1013,10 @@ export default {
wage: row.wage, wage: row.wage,
wageUnitCategory: row.wageUnitCategory, wageUnitCategory: row.wageUnitCategory,
tradeId: row.tradeId, tradeId: row.tradeId,
tradeNames: this.obj.tradeNames, tradeNames: row.tradeNames,
worktypeIds: row.skillIds[0], worktypeIds: row.workSkills[0],
worktypeNames: row.worktypeNames, worktypeNames: row.worktypeNames,
skillIds: row.skillIds[1], skillIds: row.workSkills[1],
skillNames: row.skillNames, skillNames: row.skillNames,
missionDesc: row.missionDesc, missionDesc: row.missionDesc,
userNature: row.userNature, userNature: row.userNature,
@@ -1055,9 +1066,10 @@ export default {
wage: row.wage, wage: row.wage,
wageUnitCategory: row.wageUnitCategory, wageUnitCategory: row.wageUnitCategory,
tradeId: row.tradeId, tradeId: row.tradeId,
worktypeIds: row.skillIds[0], tradeNames: row.tradeNames,
worktypeIds: row.workSkills[0],
worktypeNames: row.worktypeNames, worktypeNames: row.worktypeNames,
skillIds: row.skillIds[1], skillIds: row.workSkills[1],
skillNames: row.skillNames, skillNames: row.skillNames,
missionDesc: row.missionDesc, missionDesc: row.missionDesc,
userNature: row.userNature, userNature: row.userNature,
@@ -1139,9 +1151,13 @@ export default {
} else if (type === "edit") { } else if (type === "edit") {
this.title = "编辑任务"; this.title = "编辑任务";
detail(row.missionNo).then((res) => { detail(row.missionNo).then((res) => {
console.log(res)
this.obj = res; this.obj = res;
this.obj.workSkills = []
this.obj.workSkills.push(res.worktypeIds)
this.obj.workSkills.push(res.skillIds)
this.drawer = true; this.drawer = true;
let tradeIdState = this.tradeIdAttr.indexOf(this.obj.tradeId); // let tradeIdState = this.tradeIdAttr.indexOf(this.obj.tradeId);
}); });
} }
}); });

View File

@@ -81,7 +81,7 @@
></select-map> ></select-map>
</template> </template>
<!-- 行业类型 --> <!-- 行业类型 -->
<template slot="tradeId"> <!-- <template slot="tradeId">
<div class="tradeId"> <div class="tradeId">
<el-autocomplete <el-autocomplete
popper-class="my-autocomplete" popper-class="my-autocomplete"
@@ -92,20 +92,12 @@
show-word-limit show-word-limit
ref="selectTradeId" ref="selectTradeId"
> >
<!-- <el-button
type="primary"
:disabled = "tradeBtnState"
slot="suffix"
@click="handleIconClick"
size="mini"
>+添加</el-button> -->
<!-- <i class="el-icon-arrow-down" slot="suffix" @click="handleIconClickArrowDown"></i> -->
<template slot-scope="{ item }"> <template slot-scope="{ item }">
<div class="name">{{item.value}}</div> <div class="name">{{item.value}}</div>
</template> </template>
</el-autocomplete> </el-autocomplete>
</div> </div>
</template> </template> -->
<!-- 工种 --> <!-- 工种 -->
<template slot="worktypeIds"> <template slot="worktypeIds">
<div class="tradeId"> <div class="tradeId">
@@ -541,21 +533,24 @@ export default {
{ {
label: "行业类型", label: "行业类型",
prop: "tradeId", prop: "tradeId",
formslot: true, type: "select",
labelslot: false, dicData: this.tradeData,
errorslot: false, props: {
label: "name",
value: "id",
},
rules: [ rules: [
{ {
required: true, required: true,
validator: tradeId, // validator: tradeId,
trigger: ["change", "blur"], trigger: "blur",
}, },
], ],
span: 12, span: 12,
}, },
{ {
label: "岗位名", label: "岗位名",
prop: "skillIds", prop: "workSkills",
type: "cascader", type: "cascader",
search: true, search: true,
display: true, display: true,
@@ -1053,11 +1048,11 @@ export default {
// let skillNames = name.join(","); // let skillNames = name.join(",");
if(this.skillArr && this.skillArr.length > 0) { if(this.skillArr && this.skillArr.length > 0) {
this.skillArr.forEach(item => { this.skillArr.forEach(item => {
if(item.id == row.skillIds[0]) { if(item.id == row.workSkills[0]) {
row.worktypeNames = item.name row.worktypeNames = item.name
if(item.child && item.child.length > 0) { if(item.child && item.child.length > 0) {
item.child.forEach(item2 => { item.child.forEach(item2 => {
if(item2.id == row.skillIds[1]) { if(item2.id == row.workSkills[1]) {
row.skillNames = item2.name; row.skillNames = item2.name;
} }
}) })
@@ -1065,6 +1060,15 @@ export default {
} }
}) })
} }
if(this.tradeData && this.tradeData.length > 0) {
this.tradeData.forEach(item => {
if(row.tradeId == item.id) {
row.tradeNames = item.name
}
})
}
if (this.type === "add" || this.type === "copy") { if (this.type === "add" || this.type === "copy") {
this.$jlEvent("trialCheck") this.$jlEvent("trialCheck")
.then(() => { .then(() => {
@@ -1078,10 +1082,10 @@ export default {
wage: row.wage, wage: row.wage,
wageUnitCategory: row.wageUnitCategory, wageUnitCategory: row.wageUnitCategory,
tradeId: row.tradeId, tradeId: row.tradeId,
tradeNames: this.obj.tradeNames, tradeNames: row.tradeNames,
worktypeIds: row.skillIds[0], worktypeIds: row.workSkills[0],
worktypeNames: row.worktypeNames, worktypeNames: row.worktypeNames,
skillIds: row.skillIds[1], skillIds: row.workSkills[1],
skillNames: row.skillNames, skillNames: row.skillNames,
jobDescription: row.jobDescription, jobDescription: row.jobDescription,
userNature: row.userNature, userNature: row.userNature,
@@ -1131,10 +1135,10 @@ export default {
wage: row.wage, wage: row.wage,
wageUnitCategory: row.wageUnitCategory, wageUnitCategory: row.wageUnitCategory,
tradeId: row.tradeId, tradeId: row.tradeId,
tradeNames: this.obj.tradeNames, tradeNames: row.tradeNames,
worktypeIds: row.skillIds[0], worktypeIds: row.workSkills[0],
worktypeNames: row.worktypeNames, worktypeNames: row.worktypeNames,
skillIds: row.skillIds[1], skillIds: row.workSkills[1],
skillNames: row.skillNames, skillNames: row.skillNames,
jobDescription: row.jobDescription, jobDescription: row.jobDescription,
userNature: row.userNature, userNature: row.userNature,
@@ -1273,66 +1277,57 @@ export default {
this.title = "编辑岗位"; this.title = "编辑岗位";
detail(row.id).then((res) => { detail(row.id).then((res) => {
this.obj = res; this.obj = res;
this.obj.workSkills = []
this.obj.workSkills.push(res.worktypeIds)
this.obj.workSkills.push(res.skillIds)
this.drawer = true; this.drawer = true;
let tradeIdState = this.tradeIdAttr.indexOf(this.obj.tradeId); // let tradeIdState = this.tradeIdAttr.indexOf(this.obj.tradeId);
//判断有无此行业 //判断有无此行业
if(tradeIdState == -1){ // if(tradeIdState == -1){
this.$message.closeAll(); // this.$message.closeAll();
this.obj.tradeId = ""; // this.obj.tradeId = "";
// }else{
// this.tradeState = this.obj.tradeNames;
// //判断有无此工种
// getWork(this.obj.tradeId).then((res) => {
// this.workData = res;
// this.workDataIdAttr = res.map((ele)=>{
// return ele.id
// })
// let workDataIdState = this.workDataIdAttr.indexOf(this.obj.worktypeIds);
// //判断有无此工种
// if(workDataIdState == -1){
// this.$message.closeAll();
// this.obj.worktypeIds = "";
// }else{
// this.workTypeState = this.obj.worktypeNames;
// getSkillList(this.obj.worktypeIds).then((res) => {
// this.skillIdAttr = res.data.data.records.map((ele)=>{
// return ele;
// });
// let newSelectedSkills = [];
// this.skillIdAttr.forEach((val) => {
// let selectedSkillsState = this.obj.selectedSkills.find(v => v.id == val.id);
// if(selectedSkillsState){
// newSelectedSkills.push(val);
// }
// })
// // 判断有无此技能
// if(newSelectedSkills.length == 0){
// setTimeout(()=>{ // setTimeout(()=>{
// this.$message.closeAll();
// this.$message({ // this.$message({
// type: "error", // type: "error",
// message: "此岗位所包含行业已经不存在,请重新选择!", // message: "此岗位所包含技能已经不存在,请重新选择!",
// }) // })
// },1000); // },1000);
}else{ // }else{
this.tradeState = this.obj.tradeNames; // this.selectedSkills = newSelectedSkills;
//判断有无此工种 // }
getWork(this.obj.tradeId).then((res) => { // });
this.workData = res; // }
this.workDataIdAttr = res.map((ele)=>{
return ele.id
})
let workDataIdState = this.workDataIdAttr.indexOf(this.obj.worktypeIds);
//判断有无此工种
if(workDataIdState == -1){
this.$message.closeAll();
this.obj.worktypeIds = "";
// setTimeout(()=>{
// this.$message({
// type: "error",
// message: "此岗位所包含工种已经不存在,请重新选择!",
// }) // })
// },1000); // }
}else{
this.workTypeState = this.obj.worktypeNames;
getSkillList(this.obj.worktypeIds).then((res) => {
this.skillIdAttr = res.data.data.records.map((ele)=>{
return ele;
});
let newSelectedSkills = [];
this.skillIdAttr.forEach((val) => {
let selectedSkillsState = this.obj.selectedSkills.find(v => v.id == val.id);
if(selectedSkillsState){
newSelectedSkills.push(val);
}
})
// 判断有无此技能
if(newSelectedSkills.length == 0){
setTimeout(()=>{
this.$message.closeAll();
this.$message({
type: "error",
message: "此岗位所包含技能已经不存在,请重新选择!",
})
},1000);
}else{
this.selectedSkills = newSelectedSkills;
}
});
}
})
}
}); });
} }
}); });