@@ -541,21 +533,24 @@ export default {
{
label: "行业类型",
prop: "tradeId",
- formslot: true,
- labelslot: false,
- errorslot: false,
+ type: "select",
+ dicData: this.tradeData,
+ props: {
+ label: "name",
+ value: "id",
+ },
rules: [
{
required: true,
- validator: tradeId,
- trigger: ["change", "blur"],
+ // validator: tradeId,
+ trigger: "blur",
},
],
span: 12,
},
{
label: "岗位名",
- prop: "skillIds",
+ prop: "workSkills",
type: "cascader",
search: true,
display: true,
@@ -1053,11 +1048,11 @@ export default {
// let skillNames = name.join(",");
if(this.skillArr && this.skillArr.length > 0) {
this.skillArr.forEach(item => {
- if(item.id == row.skillIds[0]) {
+ if(item.id == row.workSkills[0]) {
row.worktypeNames = item.name
if(item.child && item.child.length > 0) {
item.child.forEach(item2 => {
- if(item2.id == row.skillIds[1]) {
+ if(item2.id == row.workSkills[1]) {
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") {
this.$jlEvent("trialCheck")
.then(() => {
@@ -1078,10 +1082,10 @@ export default {
wage: row.wage,
wageUnitCategory: row.wageUnitCategory,
tradeId: row.tradeId,
- tradeNames: this.obj.tradeNames,
- worktypeIds: row.skillIds[0],
+ tradeNames: row.tradeNames,
+ worktypeIds: row.workSkills[0],
worktypeNames: row.worktypeNames,
- skillIds: row.skillIds[1],
+ skillIds: row.workSkills[1],
skillNames: row.skillNames,
jobDescription: row.jobDescription,
userNature: row.userNature,
@@ -1131,10 +1135,10 @@ export default {
wage: row.wage,
wageUnitCategory: row.wageUnitCategory,
tradeId: row.tradeId,
- tradeNames: this.obj.tradeNames,
- worktypeIds: row.skillIds[0],
+ tradeNames: row.tradeNames,
+ worktypeIds: row.workSkills[0],
worktypeNames: row.worktypeNames,
- skillIds: row.skillIds[1],
+ skillIds: row.workSkills[1],
skillNames: row.skillNames,
jobDescription: row.jobDescription,
userNature: row.userNature,
@@ -1273,66 +1277,57 @@ export default {
this.title = "编辑岗位";
detail(row.id).then((res) => {
this.obj = res;
+ this.obj.workSkills = []
+ this.obj.workSkills.push(res.worktypeIds)
+ this.obj.workSkills.push(res.skillIds)
this.drawer = true;
- let tradeIdState = this.tradeIdAttr.indexOf(this.obj.tradeId);
+ // let tradeIdState = this.tradeIdAttr.indexOf(this.obj.tradeId);
//判断有无此行业
- if(tradeIdState == -1){
- this.$message.closeAll();
- this.obj.tradeId = "";
- // setTimeout(()=>{
- // this.$message({
- // type: "error",
- // message: "此岗位所包含行业已经不存在,请重新选择!",
- // })
- // },1000);
- }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 = "";
- // 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;
- }
- });
- }
- })
- }
+ // if(tradeIdState == -1){
+ // this.$message.closeAll();
+ // 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(()=>{
+ // this.$message.closeAll();
+ // this.$message({
+ // type: "error",
+ // message: "此岗位所包含技能已经不存在,请重新选择!",
+ // })
+ // },1000);
+ // }else{
+ // this.selectedSkills = newSelectedSkills;
+ // }
+ // });
+ // }
+ // })
+ // }
});
}
});