Files
cmanager/src/views/tenant/mission/Dialog/CopyMission.vue

1213 lines
34 KiB
Vue
Raw Normal View History

2024-02-02 15:04:47 +08:00
<template>
<el-drawer
size="70%"
append-to-body
:title="title"
:visible.sync="drawer"
:wrapperClosable="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
@closed="closed"
>
<avue-form
class="copy-form"
:option="option"
v-model="obj"
ref="form"
@submit="submit"
>
<template slot="cityId" slot-scope="{ disabled }">
2024-04-23 19:42:48 +08:00
<jl-cityLabel-cascader
2024-02-02 15:04:47 +08:00
:disabled="disabled"
filterable
v-model="obj.cityId"
placeholder="请选择 工作地址"
2024-04-23 19:42:48 +08:00
></jl-cityLabel-cascader>
2024-02-02 15:04:47 +08:00
</template>
<template slot-scope="{ disabled }" slot="skillIds">
<skill-select
ref="skillSelect"
:canSelect="!disabled"
:selectedSkills="selectedSkills"
:id="obj.worktypeIds"
@add-skill="addSkill"
@clear-validator="clearValidator('skillIds')"
></skill-select>
</template>
<template slot-scope="{ disabled }" slot="address">
<select-map
ref="selectMap"
@addAddress="addAddress"
2024-04-22 22:29:46 +08:00
@addressDel="addressDel"
@input="inputAddress"
2024-02-02 15:04:47 +08:00
:isCanEdit="!disabled"
:lng="obj.lon"
:lat="obj.lat"
:address="obj.address"
:type="type"
></select-map>
</template>
2024-04-07 14:38:43 +08:00
<template slot-scope="{ row }" slot="wage">
2024-04-14 15:46:31 +08:00
<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">
2024-04-22 22:29:46 +08:00
<el-option :label="item.label" v-for="item in wageUnitCategory" :key="item.value"
:value="item.value"></el-option>
2024-04-07 14:38:43 +08:00
</el-select>
</el-input>
</template>
2024-02-02 15:04:47 +08:00
<!-- 行业类型 -->
2024-03-01 11:28:35 +08:00
<!-- <template slot="tradeId">
2024-02-02 15:04:47 +08:00
<div class="tradeId">
2024-04-14 20:26:36 +08:00
2024-02-02 15:04:47 +08:00
<el-autocomplete
popper-class="my-autocomplete"
v-model.trim="tradeState"
:fetch-suggestions="querySearchAsync"
placeholder="请选择行业类型"
@select="handleSelect"
show-word-limit
ref="selectTradeId"
>
<template slot-scope="{ item }">
<div class="name">{{item.value}}</div>
</template>
</el-autocomplete>
</div>
2024-03-01 11:28:35 +08:00
</template> -->
2024-02-02 15:04:47 +08:00
<!-- 工种 -->
<template slot="worktypeIds">
<div class="tradeId">
2024-04-22 22:29:46 +08:00
<el-autocomplete
popper-class="my-autocomplete"
v-model.trim="workTypeState"
:fetch-suggestions="querySearchAsyncWorkType"
placeholder="请选择工种"
@select="handleSelectWorkType"
show-word-limit
:disabled="worktypeDisabled"
>
<template slot-scope="{ item }">
<div class="name">{{ item.value }}</div>
</template>
</el-autocomplete>
2024-02-02 15:04:47 +08:00
</div>
</template>
<!--/-->
<template slot-scope="{ disabled }" slot="menuForm">
<el-button
icon="el-icon-circle-close"
@click="drawer = false"
:loading="disabled"
2024-04-22 22:29:46 +08:00
>取消
</el-button
2024-02-02 15:04:47 +08:00
>
</template>
</avue-form>
</el-drawer>
</template>
<script>
2024-04-22 22:29:46 +08:00
import {add, detail, update, tradeListAdd, workListAdd, getMounthDays, getDictionary} from "@/api/tenant/mission";
import {getTrade, getWork, getWorkTypes} from "@/api/tenant/common";
2024-02-02 15:04:47 +08:00
import SkillSelect from "../Dialog/Skill";
import SelectMap from "@/components/map/selectLocation";
2024-04-22 22:29:46 +08:00
import {isvalidatemobile} from "@/util/validate";
import {mapGetters} from "vuex";
2024-02-02 15:04:47 +08:00
import {
wageUnitCategoryState,
2024-02-18 18:11:55 +08:00
wageOptionsWithNoMonth,
2024-02-02 15:04:47 +08:00
educationState,
} from "@/common/dic";
const validateTel = (rule, value, callback) => {
if (isvalidatemobile(value)[0]) {
callback(new Error(isvalidatemobile(value)[1]));
} else {
callback();
}
};
export default {
data() {
return {
2024-02-27 22:19:35 +08:00
skillArr: [],
2024-02-02 15:04:47 +08:00
id: "",
title: "",
type: "",
2024-04-22 22:29:46 +08:00
tradeBtnState: true,
workTypeBtnState: true,
worktypeDisabled: true,
2024-02-02 15:04:47 +08:00
selectedSkillIds: [],
selectedName: [],
selectedSkills: [],
tradeData: [],
2024-04-22 22:29:46 +08:00
tradeNameAttr: [],
tradeIdAttr: [],
2024-02-02 15:04:47 +08:00
workData: [],
2024-04-22 22:29:46 +08:00
workDataNameAttr: [],
workDataIdAttr: [],
skillIdAttr: [],
2024-02-02 15:04:47 +08:00
obj: {
2024-04-14 15:46:31 +08:00
wage: 0,
wageUnitCategory: 3,
2024-02-02 15:04:47 +08:00
sex: 0,
ageDesc: "不限年龄",
education: 7,
experienceDesc: "不限经验",
2024-04-22 22:29:46 +08:00
tradeId: null,
2024-02-25 17:03:18 +08:00
tradeNames: null,
2024-04-22 22:29:46 +08:00
userNature: "灵活用工",
2024-02-02 15:04:47 +08:00
},
loading: false,
drawer: false,
wageUnitCategory: wageUnitCategoryState,
restaurants: [],
tradeState: '',
2024-04-22 22:29:46 +08:00
workTypeState: '',
timeout: null,
days: null,//某个月份的天数
endTimeFlag: true,
stimeDate: null,
2024-04-14 15:46:31 +08:00
wallMaxAndMin: []
2024-02-02 15:04:47 +08:00
};
},
components: {
SkillSelect,
SelectMap,
},
created() {
this.$store.dispatch("InitArea");
this.initData();
2024-04-14 15:46:31 +08:00
this.getMaxAndMin()
2024-02-02 15:04:47 +08:00
},
watch: {
"obj.tradeId": function (val, oldval) {
if (val) {
getWork(val).then((res) => {
this.workData = res;
2024-04-22 22:29:46 +08:00
this.workDataNameAttr = res.map((ele) => {
return ele.name
})
this.workDataIdAttr = res.map((ele) => {
return ele.id
})
2024-02-02 15:04:47 +08:00
this.worktypeDisabled = false;
if (val !== oldval && oldval) {
this.obj.worktypeIds = "";
}
});
} else {
this.obj.worktypeIds = "";
}
},
2024-04-14 15:46:31 +08:00
// "obj.wageUnitCategory": function () {
// if (this.$refs.form) this.$refs.form.$refs.form.validateField("wage");
// },
2024-04-22 22:29:46 +08:00
"stimeDate": function (n) {
if (n) {
getMounthDays(n).then(res => {
this.days = res.data.data;
})
2024-02-02 15:04:47 +08:00
}
2024-04-14 15:46:31 +08:00
},
wallMaxAndMin(val) {
2024-04-22 22:29:46 +08:00
if (!val.length) {
return;
}
2024-04-14 15:46:31 +08:00
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
}
2024-02-02 15:04:47 +08:00
}
},
computed: {
...mapGetters(["area", "userInfo"]),
/*计算时间*/
startDate() {
const self = this;
if (self.obj.stime) {
return new Date(self.obj.stime);
} else {
return null;
}
},
endDate() {
const self = this;
if (self.obj.etime) {
return new Date(self.obj.etime);
} else {
return null;
}
},
siginDate() {
const self = this;
if (self.obj.etimePub) {
return new Date(self.obj.etimePub);
} else {
return null;
}
},
startTime() {
const self = this;
if (self.startDate) {
return self.startDate.getTime();
} else {
return null;
}
},
endTime() {
const self = this;
if (self.endDate) {
return self.endDate.getTime();
} else {
return null;
}
},
siginTime() {
const self = this;
if (self.siginDate) {
return self.siginDate.getTime();
} else {
return null;
}
},
option() {
const self = this;
2024-04-22 22:29:46 +08:00
const validatePass = (rule, value, callback) => {
2024-02-02 15:04:47 +08:00
let specialKey = "[`~#$^&*()=|{}\\[\\]<>/~#¥……&*()——|{}【】《》%@‘”“']'";
let flagValue = true;
for (var i = 0; i < value.length; i++) {
if (specialKey.indexOf(value.substr(i, 1)) != -1) {
flagValue = false;
}
}
2024-04-22 22:29:46 +08:00
if (flagValue) {
2024-02-02 15:04:47 +08:00
callback();
2024-04-22 22:29:46 +08:00
} else {
2024-04-25 23:06:13 +08:00
callback(new Error('岗位名称不能输入特殊字符'));
2024-02-02 15:04:47 +08:00
}
2024-04-22 22:29:46 +08:00
};
2024-02-02 15:04:47 +08:00
return {
emptyBtn: false,
menuPosition: "right",
group: [
{
label: "任务信息",
prop: "missionInfo",
arrow: false,
column: [
{
2024-04-25 23:06:13 +08:00
label: "岗位名称",
2024-02-02 15:04:47 +08:00
prop: "missionTitle",
search: true,
span: 24,
rules: [
{
required: true,
whitespace: true,
2024-04-25 23:06:13 +08:00
message: "请输入岗位名称",
2024-02-02 15:04:47 +08:00
trigger: "blur",
},
{
min: 3,
max: 30,
message: "长度在 3到 30 个字",
trigger: "blur",
},
2024-04-22 22:29:46 +08:00
{validator: validatePass, trigger: 'blur'}
2024-02-02 15:04:47 +08:00
],
},
{
2024-03-13 19:17:06 +08:00
label: "发布时间",
2024-02-02 15:04:47 +08:00
prop: "stime",
type: "date",
2024-03-13 19:17:06 +08:00
placeholder: "请选择任务发布时间",
2024-02-02 15:04:47 +08:00
format: "yyyy-MM-dd",
valueFormat: "yyyy-MM-dd 00:00:00",
pickerOptions: {
disabledDate(time) {
return !(
time.getTime() > Date.now() &&
(!self.endTime ||
(time.getTime() < self.endTime &&
time.getTime() > self.endTime - 2678400000)) &&
(!self.siginTime || time.getTime() > self.siginTime)
);
},
},
2024-04-22 22:29:46 +08:00
blur: ({value}) => {
self.obj.etime = '';
if (value) {
self.stimeDate = value.split(' ')[0]
self.endTimeFlag = false
} else {
self.endTimeFlag = true
2024-02-02 15:04:47 +08:00
}
},
rules: [
{
required: true,
message: "请选择任务开始日期",
trigger: "blur",
},
],
2024-03-13 19:17:06 +08:00
span: 12,
2024-02-02 15:04:47 +08:00
},
{
2024-03-13 19:17:06 +08:00
label: "结束时间",
2024-02-02 15:04:47 +08:00
prop: "etime",
type: "date",
placeholder: "请选择任务结束日期",
format: "yyyy-MM-dd",
2024-03-18 11:34:50 +08:00
valueFormat: "yyyy-MM-dd 23:59:59",
2024-04-22 22:29:46 +08:00
disabled: self.endTimeFlag,
2024-02-02 15:04:47 +08:00
pickerOptions: {
disabledDate(time) {
2024-04-22 22:29:46 +08:00
if (!self.obj.stime) {
2024-02-02 15:04:47 +08:00
return true
}
2024-04-22 22:29:46 +08:00
if (self.days) {
2024-03-18 11:34:50 +08:00
// let mutiply=1000*60*60*24;
2024-04-22 22:29:46 +08:00
return !(time.getTime() > Date.now() && (!self.startTime || (time.getTime() > self.startTime)))
2024-02-02 15:04:47 +08:00
}
},
},
rules: [
{
required: true,
message: "请选择任务结束日期",
trigger: "blur",
},
],
2024-03-13 19:17:06 +08:00
span: 12,
2024-02-02 15:04:47 +08:00
},
],
},
{
label: "任务要求",
prop: "missionRequire",
arrow: false,
column: [
{
label: "招聘人数",
prop: "peopleNum",
type: "number",
rules: [
{
required: true,
message: "请输入招聘人数",
trigger: "blur",
},
{
type: "number",
min: 1,
message: "招聘人数最少为1",
trigger: "blur",
},
],
span: 12,
},
{
label: "参考工资",
prop: "wage",
2024-02-17 00:06:20 +08:00
type: "select",
2024-04-07 14:38:43 +08:00
formslot: true,
labelslot: false,
errorslot: false,
// dicData: wageOptionsWithNoMonth,
// rules: [
// {
// required: true,
// trigger: "blur",
// },
// ],
// span: 12,
2024-02-02 15:04:47 +08:00
},
{
2024-04-07 15:00:20 +08:00
label: "零工工种",
2024-03-01 11:28:35 +08:00
prop: "workSkills",
2024-02-29 20:26:29 +08:00
type: "cascader",
search: true,
display: true,
dicUrl: `/api/jobslink-api/tenant/worktypes/base/list?type=1`,
dicFormatter: (res) => {
return res.data; //返回字典的层级结构
},
props: {
label: "name",
value: "id",
2024-02-29 20:26:29 +08:00
children: "child"
},
2024-02-02 15:04:47 +08:00
rules: [
{
required: true,
2024-02-17 12:06:48 +08:00
message: "请输入工种",
trigger: "blur",
2024-02-02 15:04:47 +08:00
},
],
span: 12,
},
{
label: "任务描述",
prop: "missionDesc",
type: "textarea",
rules: [
{
required: true,
whitespace: true,
message: "请输入任务描述",
trigger: "blur",
},
{
min: 30,
max: 200,
message: "长度在 30 到 200 个字",
trigger: "blur",
},
],
placeholder: "请输入任务描述字数30-200字以内",
span: 24,
maxlength: 200,
showWordLimit: true,
},
],
},
{
label: "人员要求",
prop: "personRequire",
arrow: false,
column: [
{
label: "年龄要求",
type: "select",
prop: "ageDesc",
dicData: [
{
label: "不限年龄",
value: "不限年龄",
},
{
label: "30以下",
value: "30以下",
},
{
label: "35以下",
value: "35以下",
},
{
label: "40以下",
value: "40以下",
},
{
label: "45以下",
value: "45以下",
},
{
label: "50以下",
value: "50以下",
},
{
label: "55以下",
value: "55以下",
},
{
label: "60以下",
value: "60以下",
},
],
span: 8,
clearable: false,
},
{
label: "学历要求",
type: "select",
prop: "education",
dicData: educationState,
span: 8,
clearable: false,
},
{
label: "经验要求",
type: "select",
prop: "experienceDesc",
dicData: [
{
label: "不限经验",
value: "不限经验",
},
{
label: "1年以下",
value: "1年以下",
},
{
label: "1~3年",
value: "1~3年",
},
{
label: "3~5年",
value: "3~5年",
},
{
label: "5~10年",
value: "5~10年",
},
{
label: "10年以上",
value: "10年以上",
},
],
span: 8,
clearable: false,
},
],
},
{
2024-02-15 20:57:42 +08:00
label: "企业信息",
2024-02-02 15:04:47 +08:00
prop: "contactsRequire",
arrow: false,
column: [
2024-02-15 20:57:42 +08:00
{
2024-04-23 21:50:27 +08:00
label: "用工单位",
2024-02-15 20:57:42 +08:00
prop: "missionCompanyName",
rules: [
{
required: true,
2024-04-23 21:50:27 +08:00
message: "请输入用工单位",
2024-02-15 20:57:42 +08:00
trigger: "blur",
},
],
span: 12,
2024-02-15 20:57:42 +08:00
},
{
label: "企业信用代码",
2024-02-15 20:57:42 +08:00
prop: "missionCompanyScale",
rules: [
{
required: true,
message: "请输入企业信用代码",
2024-02-15 20:57:42 +08:00
trigger: "blur",
},
],
span: 12,
2024-02-15 20:57:42 +08:00
},
{
label: "所属行业",
prop: "missionCompanyIndustry",
rules: [
{
required: true,
2024-02-16 00:04:22 +08:00
message: "请输入所属行业",
2024-02-15 20:57:42 +08:00
trigger: "blur",
},
],
2024-03-28 20:47:38 +08:00
type: "select",
dicData: this.tradeData,
props: {
label: "name",
2024-04-22 22:29:46 +08:00
value: "name",
2024-03-28 20:47:38 +08:00
},
span: 12,
2024-02-15 20:57:42 +08:00
},
{
label: "企业性质",
prop: "missionCompanyNature",
2024-05-05 17:29:22 +08:00
type: 'select',
2024-05-06 12:34:21 +08:00
dicUrl: "/api/jobslink-api/system/dict-biz/dictionary?code=company_nature",
2024-05-05 17:29:22 +08:00
props: {
2024-05-06 12:34:21 +08:00
label: "dictValue",
2024-05-06 17:32:04 +08:00
value: "dictkey",
2024-05-05 17:29:22 +08:00
},
2024-02-15 20:57:42 +08:00
rules: [
{
required: true,
2024-02-16 00:04:22 +08:00
message: "请输入企业性质",
2024-02-15 20:57:42 +08:00
trigger: "blur",
},
],
span: 12,
2024-02-15 20:57:42 +08:00
},
{
label: "企业介绍",
prop: "missionCompanyDescription",
type: "textarea",
2024-02-15 20:57:42 +08:00
rules: [
{
required: true,
2024-02-16 00:04:22 +08:00
message: "请输入企业介绍",
2024-02-15 20:57:42 +08:00
trigger: "blur",
},
{
min: 30,
max: 200,
message: "长度在 30 到 200 个字",
trigger: "blur",
},
2024-02-15 20:57:42 +08:00
],
placeholder: "请输入企业介绍字数30-200字以内",
span: 24,
maxlength: 200,
showWordLimit: true,
2024-02-15 20:57:42 +08:00
},
2024-02-02 15:04:47 +08:00
{
label: "联系人",
prop: "callName",
rules: [
{
required: true,
whitespace: true,
message: "请输入联系人",
trigger: "blur",
},
{
min: 1,
max: 5,
message: "长度在 1 到 5 个字",
trigger: "blur",
},
],
span: 8,
},
{
label: "手机号",
prop: "callTel",
rules: [
{
required: true,
validator: validateTel,
trigger: "blur",
},
],
span: 8,
},
{
label: "座机",
prop: "callNumber",
span: 8,
},
{
label: "工作地址",
type: "input",
prop: "cityId",
rules: [
{
required: true,
message: "请选择工作地址",
},
],
formslot: true,
labelslot: false,
errorslot: false,
span: 24,
},
{
label: "详细地址",
prop: "address",
formslot: true,
labelslot: false,
errorslot: false,
rules: [
{
required: true,
whitespace: true,
message: "请输入详细地址",
trigger: "blur",
},
],
span: 24,
},
],
},
],
};
},
},
methods: {
2024-04-14 15:46:31 +08:00
wageBlur(e) {
const value = e.target.value
const val = this.wallMaxAndMin
2024-04-22 22:29:46 +08:00
if (!val.length) {
return;
}
2024-04-14 15:46:31 +08:00
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}`
}
2024-04-22 22:29:46 +08:00
const arr = []
2024-04-14 15:46:31 +08:00
const resData = await getDictionary(params)
2024-04-22 22:29:46 +08:00
if (resData.data.code === 200) {
2024-04-14 15:46:31 +08:00
resData.data.data.map((item) => {
arr.push(Number(item.dictKey))
})
this.wallMaxAndMin = arr
}
},
inputAddress(val) {
this.obj.address = val;
},
2024-02-02 15:04:47 +08:00
//过滤行业类型
querySearchAsync(queryString, cb) {
let results = [];
let tradeNameState = this.tradeNameAttr.indexOf(queryString);
2024-04-22 22:29:46 +08:00
if (tradeNameState == -1) {
2024-02-02 15:04:47 +08:00
this.tradeBtnState = false;
2024-04-22 22:29:46 +08:00
} else {
2024-02-02 15:04:47 +08:00
this.tradeBtnState = true;
}
2024-04-22 22:29:46 +08:00
for (let i of this.tradeData) {
i.value = i.name;
}
results = queryString ? this.tradeData.filter(this.createStateFilter(queryString)) : this.tradeData;
cb(results);
},
//工种筛选
querySearchAsyncWorkType(queryString, cb) {
2024-02-02 15:04:47 +08:00
2024-04-22 22:29:46 +08:00
let results = [];
let workDataNameState = this.workDataNameAttr.indexOf(queryString);
if (workDataNameState == -1) {
this.workTypeBtnState = false;
} else {
2024-02-02 15:04:47 +08:00
this.workTypeBtnState = true;
2024-04-22 22:29:46 +08:00
}
for (let i of this.workData) {
i.value = i.name;
}
results = queryString ? this.workData.filter(this.createStateFilter(queryString)) : this.workData;
cb(results);
},
createStateFilter(queryString) {
return (state) => {
return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
};
},
//行业类型
handleSelect(item) {
console.log('11111111111')
console.log(item)
this.tradeBtnState = true;
this.obj.tradeId = item.id
this.obj.tradeNames = item.name
},
//工种
handleSelectWorkType(item) {
console.log('222222')
this.workTypeBtnState = true;
this.obj.worktypeIds = item.id;
console.log(item)
},
//点击行业类型添加按钮
handleIconClick() {
this.$message.closeAll();
let nameState = this.tradeNameAttr.indexOf(this.tradeState)
if (this.tradeState == "") {
this.$message({
type: "error",
message: "请输入要添加的行业类型!",
})
} else if (nameState != -1) {
this.$message({
type: "error",
message: "此行业类型已存在,请在列表中选择!",
})
} else {
tradeListAdd(this.tradeState).then((res) => {
if (res.data.code == 200) {
this.obj.tradeId = res.data.data;
this.$message({
type: "success",
message: res.data.msg,
})
this.tradeBtnState = true;
this.initData();
this.clearValidator('tradeId');
} else {
2024-02-02 15:04:47 +08:00
this.$message({
type: "error",
2024-04-22 22:29:46 +08:00
message: res.data.msg,
})
}
2024-02-02 15:04:47 +08:00
});
2024-04-22 22:29:46 +08:00
}
2024-02-02 15:04:47 +08:00
2024-04-22 22:29:46 +08:00
},
//点击工种添加按钮
handleIconClickWorkType() {
this.$message.closeAll();
let nameState = this.workDataNameAttr.indexOf(this.workTypeState)
if (this.workTypeState == "") {
this.$message({
type: "error",
message: "请输入要添加的工种!",
})
} else if (nameState != -1) {
this.$message({
type: "error",
message: "此工种已存在,请在列表中选择!",
})
} else {
workListAdd(this.obj.tradeId, this.workTypeState).then((res) => {
if (res.data.code == 200) {
this.obj.worktypeIds = res.data.data;
2024-02-02 15:04:47 +08:00
this.$message({
2024-04-22 22:29:46 +08:00
type: "success",
message: res.data.msg,
})
this.workTypeBtnState = true;
this.clearValidator('worktypeIds');
getWork(this.obj.tradeId).then((res) => {
this.workData = res;
this.workDataNameAttr = res.map((ele) => {
return ele.name
2024-02-02 15:04:47 +08:00
})
2024-04-22 22:29:46 +08:00
})
} else {
this.$message({
type: "error",
message: res.data.msg,
})
}
2024-02-02 15:04:47 +08:00
});
2024-04-22 22:29:46 +08:00
}
2024-02-02 15:04:47 +08:00
2024-04-22 22:29:46 +08:00
},
2024-02-02 15:04:47 +08:00
//
2024-04-22 22:29:46 +08:00
addressDel() {
2024-02-02 15:04:47 +08:00
this.obj.address = "";
},
initData() {
/*获取行业类型*/
this.loading = true;
getTrade(this.userInfo.company_id).then((res) => {
this.tradeData = res;
2024-04-22 22:29:46 +08:00
this.tradeNameAttr = res.map((ele) => {
2024-02-02 15:04:47 +08:00
return ele.name
})
2024-04-22 22:29:46 +08:00
this.tradeIdAttr = res.map((ele) => {
2024-02-02 15:04:47 +08:00
return ele.id
})
this.loading = false;
});
// 获取工种
getWorkTypes(1).then(res => {
console.log(res)
2024-02-27 22:19:35 +08:00
this.skillArr = res.data.data;
})
2024-02-02 15:04:47 +08:00
},
closed() {
this.tradeState = "";
this.workTypeState = "";
this.$refs.form.init();
this.$refs.form.resetForm();
this.$refs.form.clearValidate();
this.obj = {
2024-04-14 15:46:31 +08:00
wageUnitCategory: 3,
2024-02-02 15:04:47 +08:00
sex: 0,
ageDesc: "不限年龄",
education: 7,
experienceDesc: "不限经验",
2024-04-22 22:29:46 +08:00
userNature: "灵活用工",
2024-02-02 15:04:47 +08:00
};
},
/*地图*/
addAddress(form) {
this.obj.address = form.address + (form.title || "");
this.obj.lat = form.lat;
this.obj.lon = form.lng;
},
/*技能*/
addSkill(arr) {
if (arr.length) {
this.selectedSkills = arr;
} else {
this.selectedSkills = [];
}
},
submit(row, done) {
2024-04-22 22:29:46 +08:00
if (this.$refs.selectMap.addressLocation == "") {
2024-02-02 15:04:47 +08:00
this.$message({
type: "error",
message: "请选择详细地址!",
});
2024-04-22 22:29:46 +08:00
} else {
2024-02-02 15:04:47 +08:00
row.address = this.$refs.selectMap.addressLocation;
2024-04-22 22:29:46 +08:00
// let ids = [];
// let name = [];
// this.selectedSkills.forEach((ele) => {
// ids.push(ele.id);
// name.push(ele.name);
// });
if (this.skillArr && this.skillArr.length > 0) {
this.skillArr.forEach(item => {
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.workSkills[1]) {
row.skillNames = item2.name;
}
})
}
2024-02-29 20:26:29 +08:00
}
2024-04-22 22:29:46 +08:00
})
}
2024-03-13 19:17:06 +08:00
2024-04-22 22:29:46 +08:00
if (this.tradeData && this.tradeData.length > 0) {
this.tradeData.forEach(item => {
if (row.tradeId == item.id) {
row.tradeNames = item.name
}
})
}
2024-03-01 11:28:35 +08:00
2024-03-13 19:17:06 +08:00
2024-04-22 22:29:46 +08:00
if (this.type === "add" || this.type === "copy") {
this.$jlEvent("trialCheck")
.then(() => {
add({
2024-02-02 15:04:47 +08:00
2024-04-22 22:29:46 +08:00
missionTitle: row.missionTitle,
stime: row.stime,
etime: row.etime,
etimePub: row.etimePub,
peopleNum: row.peopleNum,
wage: row.wage,
wageUnitCategory: row.wageUnitCategory,
tradeId: row.tradeId,
tradeNames: row.tradeNames,
worktypeIds: row.workSkills[0],
worktypeNames: row.worktypeNames,
skillIds: row.workSkills[1],
skillNames: row.skillNames,
missionDesc: row.missionDesc,
userNature: row.userNature,
sex: row.sex,
ageDesc: row.ageDesc,
education: row.education,
experienceDesc: row.experienceDesc,
missionCompanyName: row.missionCompanyName,
missionCompanyScale: row.missionCompanyScale,
missionCompanyIndustry: row.missionCompanyIndustry,
missionCompanyNature: row.missionCompanyNature,
missionCompanyDescription: row.missionCompanyDescription,
callName: row.callName,
callTel: row.callTel,
callNumber: row.callNumber,
cityId: row.cityId,
address: row.address,
lat: row.lat,
lon: row.lon,
}).then(
() => {
this.drawer = false;
done();
this.$message({
type: "success",
message: "操作成功!",
});
this.$emit("back");
},
(error) => {
window.console.log(error);
done();
}
);
})
.catch(() => {
done();
2024-02-02 15:04:47 +08:00
});
2024-04-22 22:29:46 +08:00
} else if (this.type === "edit") {
update({
id: this.id,
missionTitle: row.missionTitle,
stime: row.stime,
etime: row.etime,
etimePub: row.etimePub,
peopleNum: row.peopleNum,
wage: row.wage,
wageUnitCategory: row.wageUnitCategory,
tradeId: row.tradeId,
tradeNames: row.tradeNames,
worktypeIds: row.workSkills[0],
worktypeNames: row.worktypeNames,
skillIds: row.workSkills[1],
skillNames: row.skillNames,
missionDesc: row.missionDesc,
userNature: row.userNature,
sex: row.sex,
ageDesc: row.ageDesc,
education: row.education,
experienceDesc: row.experienceDesc,
missionCompanyIndustry: row.missionCompanyIndustry,
missionCompanyDescription: row.missionCompanyDescription,
callName: row.callName,
callTel: row.callTel,
callNumber: row.callNumber,
cityId: row.cityId,
address: row.address,
lat: row.lat,
lon: row.lon,
}).then(
() => {
this.drawer = false;
done();
this.$message({
type: "success",
message: "操作成功!",
});
this.$emit("back");
},
(error) => {
window.console.log(error);
done();
}
);
}
2024-02-02 15:04:47 +08:00
}
},
2024-04-22 22:29:46 +08:00
clearValidator(val) {
2024-02-02 15:04:47 +08:00
this.$refs.form.clearValidate(val);
},
onLoad(row, type) {
this.type = type;
this.id = row.id;
this.$nextTick(() => {
2024-04-22 22:29:46 +08:00
if (type != 'edit') {
// getLastTaskInfo().then(res=>{
// const data=res.data.data;
// this.obj.callName=data.callName;
// this.obj.callTel=data.callTel;
// })
2024-02-02 15:04:47 +08:00
}
if (type === "copy") {
this.title = "复制任务";
detail(row.missionNo).then((res) => {
if (![1, 2].includes(res.wageUnitCategory)) {
res.wageUnitCategory = null;
}
this.obj = res;
this.obj.etimePub = "";
this.obj.stime = "";
this.obj.etime = "";
this.drawer = true;
});
} else if (type === "add") {
this.title = "发布任务";
this.obj = {
2024-04-14 15:46:31 +08:00
wageUnitCategory: 3,
2024-02-02 15:04:47 +08:00
sex: 0,
ageDesc: "不限年龄",
education: 7,
experienceDesc: "不限经验",
2024-04-22 22:29:46 +08:00
userNature: "灵活用工"
2024-02-02 15:04:47 +08:00
};
this.selectedSkills = [];
this.drawer = true;
2024-04-22 22:29:46 +08:00
this.$nextTick(() => {
2024-02-02 15:04:47 +08:00
this.$refs.form.clearValidate();
})
if (this.$refs.selectMap) {
this.$refs.selectMap.geolocation();
}
} else if (type === "edit") {
this.title = "编辑任务";
detail(row.missionNo).then((res) => {
2024-04-22 22:29:46 +08:00
if (res.cityId === -1) {
2024-04-14 20:26:36 +08:00
res.cityId = ''
}
2024-02-02 15:04:47 +08:00
this.obj = res;
2024-03-01 11:28:35 +08:00
this.obj.workSkills = []
this.obj.workSkills.push(res.worktypeIds)
this.obj.workSkills.push(res.skillIds)
2024-02-02 15:04:47 +08:00
this.drawer = true;
2024-03-01 11:28:35 +08:00
// let tradeIdState = this.tradeIdAttr.indexOf(this.obj.tradeId);
2024-02-02 15:04:47 +08:00
});
}
});
},
},
mounted() {
2024-04-22 22:29:46 +08:00
}
2024-02-02 15:04:47 +08:00
};
</script>
<style scoped>
.el-col,
.el-form-item {
margin-bottom: 0px;
}
</style>
<style>
.input-with-select {
width: 100%;
}
2024-04-22 22:29:46 +08:00
2024-02-02 15:04:47 +08:00
.copy-form .el-input-group__append {
background-color: #fff;
}
2024-04-22 22:29:46 +08:00
2024-02-02 15:04:47 +08:00
.input-with-select .el-input-group__append .el-input__icon {
display: none;
}
2024-04-22 22:29:46 +08:00
2024-02-02 15:04:47 +08:00
.input-with-select .el-input-group__append input {
width: 105px;
padding: 0;
text-align: center;
}
2024-04-22 22:29:46 +08:00
.my-autocomplete li {
2024-02-02 15:04:47 +08:00
line-height: normal;
2024-04-22 22:29:46 +08:00
padding: 7px;
2024-02-02 15:04:47 +08:00
}
2024-04-22 22:29:46 +08:00
.my-autocomplete li .name {
text-overflow: ellipsis;
overflow: hidden;
2024-02-02 15:04:47 +08:00
}
2024-04-22 22:29:46 +08:00
.my-autocomplete li .addr {
font-size: 12px;
color: #b4b4b4;
2024-02-02 15:04:47 +08:00
}
2024-04-22 22:29:46 +08:00
.my-autocomplete li .highlighted .addr {
color: #ddd;
2024-02-02 15:04:47 +08:00
}
2024-04-22 22:29:46 +08:00
.tradeId .el-autocomplete {
width: 100%;
2024-02-02 15:04:47 +08:00
}
2024-04-22 22:29:46 +08:00
.tradeId .el-icon-plus:before {
content: "\e6d9 添加行业类型";
color: #606266;
2024-02-02 15:04:47 +08:00
}
2024-04-22 22:29:46 +08:00
.tradeId .el-input--small input {
2024-02-02 15:04:47 +08:00
padding-right: 150px;
}
</style>