flat: 暂存

This commit is contained in:
Apcallover
2024-04-14 15:46:31 +08:00
parent 3483786677
commit 66d0653a8c
7 changed files with 118 additions and 21 deletions

View File

@@ -51,8 +51,8 @@
></select-map>
</template>
<template slot-scope="{ row }" slot="wage">
<el-input placeholder="请输入工资" v-model="obj.wage" class="input-with-select">
<el-select v-model="obj.wageUnitCategory" slot="append" placeholder="请选择">
<el-input placeholder="请输入工资" type="number" v-model="obj.wage" class="input-with-select" @blur="wageBlur">
<el-select v-model="obj.wageUnitCategory" slot="append" placeholder="请选择" @change="getMaxAndMin">
<el-option :label="item.label" v-for="item in wageUnitCategory" :key="item.value" :value="item.value"></el-option>
</el-select>
</el-input>
@@ -107,7 +107,7 @@
</template>
<script>
import { add, detail, update, tradeListAdd, workListAdd,getMounthDays} from "@/api/tenant/mission";
import { add, detail, update, tradeListAdd, workListAdd,getMounthDays, getDictionary} from "@/api/tenant/mission";
import { getTrade, getWork, getWorkTypes} from "@/api/tenant/common";
import SkillSelect from "../Dialog/Skill";
import SelectMap from "@/components/map/selectLocation";
@@ -148,7 +148,8 @@ export default {
workDataIdAttr:[],
skillIdAttr:[],
obj: {
wageUnitCategory: null,
wage: 0,
wageUnitCategory: 3,
sex: 0,
ageDesc: "不限年龄",
education: 7,
@@ -167,6 +168,7 @@ export default {
days:null,//某个月份的天数
endTimeFlag:true,
stimeDate:null,
wallMaxAndMin: []
};
},
components: {
@@ -176,7 +178,7 @@ export default {
created() {
this.$store.dispatch("InitArea");
this.initData();
this.getMaxAndMin()
},
watch: {
"obj.tradeId": function (val, oldval) {
@@ -198,15 +200,27 @@ export default {
this.obj.worktypeIds = "";
}
},
"obj.wageUnitCategory": function () {
if (this.$refs.form) this.$refs.form.$refs.form.validateField("wage");
},
// "obj.wageUnitCategory": function () {
// if (this.$refs.form) this.$refs.form.$refs.form.validateField("wage");
// },
"stimeDate":function(n){
if(n){
getMounthDays(n).then(res=>{
this.days=res.data.data;
})
}
},
wallMaxAndMin(val) {
if(!val.length) {return;}
switch (true) {
case this.obj.wage < Math.min(...val):
this.obj.wage = Math.min(...val)
return
case this.obj.wage > Math.max(...val):
this.obj.wage = Math.max(...val)
return
}
}
},
computed: {
@@ -709,6 +723,32 @@ export default {
},
},
methods: {
wageBlur(e) {
const value = e.target.value
const val = this.wallMaxAndMin
if(!val.length) {return;}
switch (true) {
case this.obj.wage < Math.min(...val):
this.obj.wage = Math.min(...val)
return
case this.obj.wage > Math.max(...val):
this.obj.wage = Math.max(...val)
return
}
},
async getMaxAndMin(id) {
let params = {
code: `wages_limit_${this.obj.wageUnitCategory}`
}
const arr = []
const resData = await getDictionary(params)
if(resData.data.code === 200) {
resData.data.data.map((item) => {
arr.push(Number(item.dictKey))
})
this.wallMaxAndMin = arr
}
},
inputAddress(val) {
this.obj.address = val;
},
@@ -868,7 +908,7 @@ export default {
this.$refs.form.resetForm();
this.$refs.form.clearValidate();
this.obj = {
wageUnitCategory: null,
wageUnitCategory: 3,
sex: 0,
ageDesc: "不限年龄",
education: 7,
@@ -1064,7 +1104,7 @@ export default {
} else if (type === "add") {
this.title = "发布任务";
this.obj = {
wageUnitCategory: 2,
wageUnitCategory: 3,
sex: 0,
ageDesc: "不限年龄",
education: 7,