Commit f76fbad0 by wangzhihui

fixed

1 parent 1dcdcf2e
...@@ -100,4 +100,22 @@ export function findMerchantStaffList(data) { ...@@ -100,4 +100,22 @@ export function findMerchantStaffList(data) {
export function linkMerchant(data) { export function linkMerchant(data) {
data.method = `dj.staff.api.recruitment.demand.link.merchant`; data.method = `dj.staff.api.recruitment.demand.link.merchant`;
return request(data); return request(data);
}
// 试岗计划审批(通过/驳回)
export function trialOnboardingApproval(data) {
data.method = `dj.staff.api.recruitment.trial.onboarding.approval`;
return request(data);
}
// 试岗门店列表
export function getTrialOnboardingStoreList(data) {
data.method = `dj.staff.api.recruitment.demand.store.list`;
return request(data);
}
// 招聘需求业务场景列表
export function getRecruitmentDemandSubSceneList(data) {
data.method = `dj.staff.api.recruitment.demand.sub.scene.list`;
return request(data);
} }
\ No newline at end of file \ No newline at end of file
...@@ -2083,6 +2083,16 @@ export const trialStatusOpt = [ ...@@ -2083,6 +2083,16 @@ export const trialStatusOpt = [
confValue: "无试岗", confValue: "无试岗",
}, },
]; ];
export const approvalStatusOpt=[
{
confId: 0,
confValue: "待审批",
},
{
confId: 1,
confValue: "已审批",
},
]
export const connectionFlagOptMap = { export const connectionFlagOptMap = {
true: "#2CCA74", true: "#2CCA74",
false: "#EB4E4E", false: "#EB4E4E",
......
...@@ -109,6 +109,7 @@ export default { ...@@ -109,6 +109,7 @@ export default {
salesVolume: "", salesVolume: "",
brand: [], brand: [],
merchantAddress: "", merchantAddress: "",
merchantAddressDetail: "",
provinceCityCode: "", provinceCityCode: "",
province: "", province: "",
...@@ -145,12 +146,21 @@ export default { ...@@ -145,12 +146,21 @@ export default {
isHide: true, isHide: true,
}, },
{ {
label: "门店地址", label: "所属省市",
name: "merchantAddress", name: "merchantAddress",
addHtml: "merchantAddressHtml", addHtml: "merchantAddressHtml",
isHide: true, isHide: true,
}, },
{ {
label: "详细地址",
name: "merchantAddressDetail",
type: "input",
isClear: true,
maxlength: 60,
showLimit: true,
isHide: true,
},
{
label: "业务类型", label: "业务类型",
name: "businessType", name: "businessType",
type: "select", type: "select",
...@@ -278,7 +288,24 @@ export default { ...@@ -278,7 +288,24 @@ export default {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if (this.addForm.bySystemMerchant) { if (this.addForm.bySystemMerchant) {
if (!this.addForm.provinceCode || !this.addForm.provinceCityCode) { if (!this.addForm.provinceCode || !this.addForm.provinceCityCode) {
callback(new Error("请选择门店地址")); callback(new Error("请选择省市"));
} else {
callback();
}
} else {
callback();
}
},
trigger: ["change", "blur"],
},
],
merchantAddressDetail: [
{
required: true,
validator: (rule, value, callback) => {
if (this.addForm.bySystemMerchant) {
if (!value || !value.trim()) {
callback(new Error("请输入详细地址"));
} else { } else {
callback(); callback();
} }
...@@ -460,7 +487,7 @@ export default { ...@@ -460,7 +487,7 @@ export default {
}) })
}, },
handleIsNewMerchantChange(val) { handleIsNewMerchantChange(val) {
const fieldsToToggle = ["salesVolume", "brand", "merchantAddress"]; const fieldsToToggle = ["salesVolume", "brand", "merchantAddress", "merchantAddressDetail"];
fieldsToToggle.forEach((name) => { fieldsToToggle.forEach((name) => {
const index = this.editFormData.findIndex(k => k.name === name); const index = this.editFormData.findIndex(k => k.name === name);
if (index > -1) { if (index > -1) {
...@@ -478,6 +505,7 @@ export default { ...@@ -478,6 +505,7 @@ export default {
this.addForm.cityCode = ""; this.addForm.cityCode = "";
this.addForm.cityName = ""; this.addForm.cityName = "";
this.addForm.merchantAddress = ""; this.addForm.merchantAddress = "";
this.addForm.merchantAddressDetail = "";
if (this.$refs.provinceCityRef) { if (this.$refs.provinceCityRef) {
this.$refs.provinceCityRef.init("", "", ""); this.$refs.provinceCityRef.init("", "", "");
} }
...@@ -538,6 +566,7 @@ export default { ...@@ -538,6 +566,7 @@ export default {
params.salesVolume = this.addForm.salesVolume; params.salesVolume = this.addForm.salesVolume;
params.brand = brands.join("/"); params.brand = brands.join("/");
params.merchantAddress = this.addForm.merchantAddress; params.merchantAddress = this.addForm.merchantAddress;
params.merchantAddressDetail = this.addForm.merchantAddressDetail;
params.province = this.addForm.province; params.province = this.addForm.province;
params.provinceCityCode = this.addForm.provinceCityCode; params.provinceCityCode = this.addForm.provinceCityCode;
} }
......
...@@ -54,12 +54,18 @@ export default { ...@@ -54,12 +54,18 @@ export default {
hasTooltip: true, hasTooltip: true,
}, },
{ {
title: "门店地址", title: "所属省市",
key: "merchantAddress", key: "merchantAddress",
style: contentStyle, style: contentStyle,
hasTooltip: true, hasTooltip: true,
}, },
{ {
title: "详细地址",
key: "merchantAddressDetail",
style: contentStyle,
hasTooltip: true,
},
{
title: "业务类型", title: "业务类型",
key: "businessTypeName", key: "businessTypeName",
}, },
......
...@@ -34,15 +34,37 @@ ...@@ -34,15 +34,37 @@
</div> </div>
</div> </div>
<div v-if="isBtn" class="btns"> <div v-if="isBtn" class="btns">
<el-button v-if="isPendingTrial(item)" type="text" @click="handleEdit(item, index)"> <el-button v-if="isPendingApproval(item)" type="text" @click="handleApprove(item, index)">
通过
</el-button>
<el-button v-if="isPendingApproval(item)" type="text" @click="handleReject(item, index)">
驳回
</el-button>
<el-button
v-if="isPendingTrial(item)"
type="text"
:disabled="!canOperateTrial(item)"
@click="handleEdit(item, index)"
>
编辑 编辑
</el-button> </el-button>
<el-button v-if="isPendingTrial(item)" type="text" @click="handleResolve(item, index)"> <el-button
v-if="isPendingTrial(item)"
type="text"
:disabled="!canOperateTrial(item)"
@click="handleResolve(item, index)"
>
处理 处理
</el-button> </el-button>
<el-button v-if="isPendingTrial(item)" type="text" @click="handleDelete(index)"> <el-button
v-if="isPendingTrial(item)"
type="text"
:disabled="!canOperateTrial(item)"
@click="handleDelete(index)"
>
删除 删除
</el-button> </el-button>
<el-button v-if="isProcessedTrial(item)" type="text" @click="handleWorking(item)"> <el-button v-if="isProcessedTrial(item)" type="text" @click="handleWorking(item)">
转入职 转入职
</el-button> </el-button>
...@@ -50,11 +72,11 @@ ...@@ -50,11 +72,11 @@
查看结果 查看结果
</el-button> </el-button>
</div> </div>
<div else class="btns"> <div v-else class="btns">
<el-button v-if="isProcessedTrial(item)" type="text" @click="handleViewResult(item)"> <el-button v-if="isProcessedTrial(item)" type="text" @click="handleViewResult(item)">
查看结果 查看结果
</el-button> </el-button>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
...@@ -65,18 +87,33 @@ ...@@ -65,18 +87,33 @@
</div> </div>
</div> </div>
<!-- 新增试岗 --> <!-- 新增试岗 -->
<glsk-form-dialog v-if="isAddVisible" ref="addResumeDialog" :base-data="baseData" default-width="406px" :dialog-config="isAddDialogConfig" :edit-data="isAddForm" :edit-form-data="isAddFormData" :form-rules="isAddRules" label-width="150px" :select-visible="isAddVisible" :slot-arr="slotArr" @handleAddSelectTypeConfirm="handleAddSelectTypeConfirm" @handleClose="isAddDialogVisible" @handleConfirm="handleAddConfirm" @handleEditSelectTypeConfirm="handleEditSelectTypeConfirm"> <glsk-form-dialog v-if="isAddVisible" :key="addDialogKey" ref="addResumeDialog" :base-data="baseData" default-width="406px" :dialog-config="isAddDialogConfig" :edit-data="isAddForm" :edit-form-data="isAddFormData" :form-rules="isAddRules" label-width="150px" :select-visible="isAddVisible" :slot-arr="slotArr" @handleAddSelectTypeConfirm="handleAddSelectTypeConfirm" @handleClose="isAddDialogVisible" @handleConfirm="handleAddConfirm" @handleEditSelectTypeConfirm="handleEditSelectTypeConfirm">
</glsk-form-dialog> </glsk-form-dialog>
<!-- 试岗处理 --> <!-- 试岗处理 -->
<glsk-form-dialog v-if="isResolveVisible" :base-data="baseData" default-width="406px" :dialog-config="isResolveDialogConfig" :edit-data="isResolveForm" :edit-form-data="isResolveFormData" :form-rules="isResolveRules" label-width="150px" :select-visible="isResolveVisible" @handleClose="isResolveDialogVisible" @handleConfirm="handleResolveConfirm"> <glsk-form-dialog v-if="isResolveVisible" :base-data="baseData" default-width="406px" :dialog-config="isResolveDialogConfig" :edit-data="isResolveForm" :edit-form-data="isResolveFormData" :form-rules="isResolveRules" label-width="150px" :select-visible="isResolveVisible" @handleClose="isResolveDialogVisible" @handleConfirm="handleResolveConfirm">
</glsk-form-dialog> </glsk-form-dialog>
<!-- 试岗审批驳回 -->
<glsk-form-dialog
v-if="isRejectVisible"
:base-data="baseData"
default-width="406px"
:dialog-config="isRejectDialogConfig"
:edit-data="isRejectForm"
:edit-form-data="isRejectFormData"
:form-rules="isRejectRules"
label-width="150px"
:select-visible="isRejectVisible"
@handleClose="handleRejectClose"
@handleConfirm="handleRejectConfirm"
>
</glsk-form-dialog>
</div> </div>
</template> </template>
<script> <script>
import GlOssApi from "glsk-oss-jssdk"; import GlOssApi from "glsk-oss-jssdk";
import { mapMutations } from "vuex"; import { mapMutations } from "vuex";
import { addDict, deleteDict, getDictList, updateDict } from "@/api/recruitment"; import { addDict, deleteDict, getDictList, getRecruitmentDemandSubSceneList, getTrialOnboardingStoreList, trialOnboardingApproval, updateDict } from "@/api/recruitment";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
...@@ -91,6 +128,14 @@ export default { ...@@ -91,6 +128,14 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
demandId: {
type: [Number, String],
default: "",
},
businessType:{
type: [Number, String],
default: "",
}
}, },
data() { data() {
return { return {
...@@ -101,7 +146,48 @@ export default { ...@@ -101,7 +146,48 @@ export default {
imgList: [], imgList: [],
detailVisible: false, detailVisible: false,
isAddVisible: false, isAddVisible: false,
addDialogKey: 0,
isResolveVisible: false, isResolveVisible: false,
isRejectVisible: false,
approvalIndex: null,
approvalRecord: {},
isRejectDialogConfig: {
title: "驳回",
okText: "确认",
},
isRejectRules: {
approvalRemark: [
{ required: true, message: "请输入驳回原因", trigger: "blur" },
],
},
isRejectForm: {
approvalRemark: "",
txt: "驳回后,无法再进行试岗相关事项",
},
isRejectFormData: [
{
label: "驳回原因",
name: "approvalRemark",
type: "textarea",
isClear: true,
maxlength: 200,
showLimit: true,
rows: 4,
placeholder: "请输入驳回原因",
},
{
label: "",
name: "txt",
type: "showTxt",
txtStyle: {
color: "#999999",
fontSize: "14px",
marginLeft: "150px",
display: "block",
marginTop: "-15px",
},
},
],
slotArr: [], slotArr: [],
trialOnboardingsData: [], trialOnboardingsData: [],
paramsObj: {}, paramsObj: {},
...@@ -138,6 +224,21 @@ export default { ...@@ -138,6 +224,21 @@ export default {
trialTime: [ trialTime: [
{ required: true, message: "请选择试岗时间", trigger: "change" }, { required: true, message: "请选择试岗时间", trigger: "change" },
], ],
storeNo: [
{ required: true, message: "请选择试岗门店", trigger: "change" },
],
bizSceneCodes: [
{
type: "array",
required: true,
min: 1,
message: "请选择业务类型",
trigger: "change",
},
],
residentType: [
{ required: true, message: "请选择驻店类型", trigger: "change" },
],
}, },
isResolveRules: { isResolveRules: {
processResult: [ processResult: [
...@@ -147,10 +248,16 @@ export default { ...@@ -147,10 +248,16 @@ export default {
isAddForm: { isAddForm: {
personName: "", personName: "",
phoneNumber: "", phoneNumber: "",
trialTime: "", // 试岗时间 trialTime: "",
resumeFileName: "", resumeFileName: "",
channelType: "", // 招聘渠道 channelType: "",
channelName: "", channelName: "",
storeNo: "",
storeName: "",
bizSceneCodes: [],
bizSceneInfo: [],
residentType: "",
residentTypeName: "",
}, },
isAddFormData: [ isAddFormData: [
{ {
...@@ -189,12 +296,77 @@ export default { ...@@ -189,12 +296,77 @@ export default {
); );
}, },
}, },
{ {
label: "试岗时间", label: "试岗时间",
name: "trialTime", name: "trialTime",
type: "datePicker", type: "datePicker",
dateType: "date", dateType: "date",
}, },
{
label: "试岗门店",
name: "storeNo",
type: "select",
isClear: true,
noFilter: false,
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "trialStoreData",
changeAttr: async (value, targetItem) => {
console.log(value,'value')
this.isAddForm.storeName = this.filterAttribute(
targetItem.optionsName,
targetItem.optionId,
targetItem.optionLabel,
value,
);
await this.fetchBizSceneList(value);
},
},
{
label: "业务类型",
name: "bizSceneCodes",
labelRequired: true,
type: "select",
isClear: true,
multiple: true,
collapseTags: true,
noFilter: false,
noDataText: "请先选择试岗门店",
optionId: "sceneCode",
optionLabel: "sceneName",
optionsName: "bizSceneData",
changeAttr: (value) => {
this.$set(
this.isAddForm,
"bizSceneInfo",
this.buildBizSceneInfo(value),
);
if (value && value.length) {
this.$nextTick(() => {
this.clearAddFormValidate(["bizSceneCodes"]);
});
}
},
},
{
label: "驻店类型",
name: "residentType",
type: "select",
isClear: true,
noFilter: false,
optionId: "itemValue",
optionLabel: "itemName",
optionsName: "residentTypeData",
changeAttr: (value, targetItem) => {
this.isAddForm.residentTypeName = this.filterAttribute(
targetItem.optionsName,
targetItem.optionId,
targetItem.optionLabel,
value,
);
},
},
], ],
isResolveForm: { isResolveForm: {
processResult: "", processResult: "",
...@@ -226,6 +398,9 @@ export default { ...@@ -226,6 +398,9 @@ export default {
{ confId: 0, confValue: "不通过" }, { confId: 0, confValue: "不通过" },
], ],
channelData: [], channelData: [],
trialStoreData: [],
bizSceneData: [],
residentTypeData: [],
}, },
}; };
}, },
...@@ -247,18 +422,199 @@ export default { ...@@ -247,18 +422,199 @@ export default {
async fetchOnboardingPlans() { async fetchOnboardingPlans() {
try { try {
// 并行请求4个不同类型的数据 const [channelData, trialStoreData, residentTypeData] = await Promise.all([
const [channelData] = await Promise.all([
getDictList({ getDictList({
businessCode: "recruitment", businessCode: "recruitment",
typeCode: "recruitment_channel", typeCode: "recruitment_channel",
}), }),
getTrialOnboardingStoreList({
demandId: this.demandId,
}),
getDictList({
businessCode: "recruitment",
typeCode: "store_staff_type",
}),
]); ]);
// 处理返回的数据 this.baseData.channelData = channelData.list || [];
this.baseData.channelData = channelData.list; this.baseData.trialStoreData = this.normalizeListResponse(trialStoreData);
this.baseData.residentTypeData = residentTypeData.list || [];
this.getOptionsList(this, "isAddFormData", false); this.getOptionsList(this, "isAddFormData", false);
} catch (error) { } catch (error) {
console.error("获取入职计划数据失败:", error); console.error("获取失败:", error);
}
},
formatBizSceneList(list) {
return (list || []).map(item => ({
...item,
sceneCode: item.sceneCode == null || item.sceneCode === ""
? item.sceneCode
: String(item.sceneCode),
}));
},
matchSceneCode(code, sceneCode) {
return String(code) === String(sceneCode);
},
normalizeBizSceneCodes(codes, list = this.baseData.bizSceneData) {
if (!Array.isArray(codes) || !list?.length) return [];
return codes
.map((code) => {
const matched = list.find(item => this.matchSceneCode(code, item.sceneCode));
return matched ? matched.sceneCode : null;
})
.filter(Boolean);
},
setBizSceneCodes(codes, form = this.isAddForm) {
const normalizedCodes = this.normalizeBizSceneCodes(codes, this.baseData.bizSceneData);
const finalCodes = normalizedCodes.length
? [...normalizedCodes]
: (Array.isArray(codes) ? codes.map(code => String(code)) : []);
this.$set(form, "bizSceneCodes", finalCodes);
this.$set(form, "bizSceneInfo", this.buildBizSceneInfo(finalCodes));
},
clearAddFormValidate(fields = []) {
this.$nextTick(() => {
const form = this.$refs.addResumeDialog?.$refs?.editFormRef?.$refs?.editChildRef;
if (!form) return;
if (fields.length) {
fields.forEach(field => form.clearValidate(field));
} else {
form.clearValidate();
}
});
},
openAddDialog() {
this.addDialogKey += 1;
this.isAddVisible = true;
this.clearAddFormValidate();
},
normalizeListResponse(res) {
if (Array.isArray(res)) return res;
if (Array.isArray(res?.data)) return res.data;
if (Array.isArray(res?.list)) return res.list;
return [];
},
async fetchBizSceneList(storeNo, preserveSelected = false, form = this.isAddForm) {
if (!storeNo) {
this.baseData.bizSceneData = [];
this.getOptionsList(this, "isAddFormData", false, "bizSceneCodes");
if (!preserveSelected) {
this.setBizSceneCodes([], form);
}
return;
}
try {
const res = await getRecruitmentDemandSubSceneList({
merchantId: storeNo,
businessType: this.businessType,
});
const list = this.formatBizSceneList(this.normalizeListResponse(res));
this.baseData.bizSceneData = list;
this.getOptionsList(this, "isAddFormData", false, "bizSceneCodes");
if (preserveSelected) {
const normalizedSelected = this.normalizeBizSceneCodes(
form.bizSceneCodes,
list,
);
this.setBizSceneCodes(
normalizedSelected.length
? normalizedSelected
: list.map(item => item.sceneCode),
form,
);
} else {
this.setBizSceneCodes(list.map(item => item.sceneCode), form);
}
} catch (error) {
console.error("获取业务类型失败:", error);
this.baseData.bizSceneData = [];
this.getOptionsList(this, "isAddFormData", false, "bizSceneCodes");
if (!preserveSelected) {
this.setBizSceneCodes([], form);
}
}
},
buildBizSceneInfo(sceneCodes) {
if (!Array.isArray(sceneCodes) || !sceneCodes.length) return [];
return this.baseData.bizSceneData
.filter(item => sceneCodes.some(code => this.matchSceneCode(code, item.sceneCode)))
.map(({ sceneCode, sceneName }) => ({
sceneCode,
sceneName,
}));
},
resetAddForm() {
this.isAddForm = {
personName: "",
phoneNumber: "",
trialTime: "",
resumeFileName: "",
channelType: "",
channelName: "",
storeNo: "",
storeName: "",
bizSceneCodes: [],
bizSceneInfo: [],
residentType: "",
residentTypeName: "",
};
this.baseData.bizSceneData = [];
this.getOptionsList(this, "isAddFormData", false, "bizSceneCodes");
},
parseBizSceneInfo(data) {
if (!data) return [];
if (typeof data.bizSceneInfo === "string") {
try {
data.bizSceneInfo = JSON.parse(data.bizSceneInfo);
} catch (error) {
data.bizSceneInfo = [];
}
}
if (!Array.isArray(data.bizSceneInfo)) {
data.bizSceneInfo = data.bizSceneInfo ? [data.bizSceneInfo] : [];
}
return data.bizSceneInfo;
},
ensureTrialStoreOption(data) {
if (!data?.storeNo) return;
const storeId = data.storeNo;
const exists = this.baseData.trialStoreData.some(
item => String(item.merchantId) === String(storeId),
);
if (!exists) {
this.baseData.trialStoreData = [
...this.baseData.trialStoreData,
{
merchantId: storeId,
merchantName: data.storeName || String(storeId),
},
];
this.getOptionsList(this, "isAddFormData", false, "storeNo");
}
const matchedStore = this.baseData.trialStoreData.find(
item => String(item.merchantId) === String(storeId),
);
if (matchedStore) {
data.storeNo = matchedStore.merchantId;
data.storeName = data.storeName || matchedStore.merchantName;
}
},
async prepareEditForm(data) {
this.parseBizSceneInfo(data);
this.$set(
data,
"bizSceneCodes",
(data.bizSceneInfo || [])
.map(item => item.sceneCode)
.filter(code => code != null && code !== ""),
);
this.ensureTrialStoreOption(data);
if (data.storeNo) {
await this.fetchBizSceneList(data.storeNo, true, data);
} else {
this.baseData.bizSceneData = [];
this.getOptionsList(this, "isAddFormData", false, "bizSceneCodes");
this.$set(data, "bizSceneCodes", []);
this.$set(data, "bizSceneInfo", []);
} }
}, },
getOptionsList(that, formName, hasAll = true, refreshSigle) { getOptionsList(that, formName, hasAll = true, refreshSigle) {
...@@ -311,7 +667,7 @@ export default { ...@@ -311,7 +667,7 @@ export default {
}, },
isAddDialogVisible() { isAddDialogVisible() {
this.isAddForm = {}; this.resetAddForm();
this.uploadFileList = []; this.uploadFileList = [];
this.isAddVisible = !this.isAddVisible; this.isAddVisible = !this.isAddVisible;
}, },
...@@ -335,7 +691,12 @@ export default { ...@@ -335,7 +691,12 @@ export default {
data.trialTime data.trialTime
? (data.trialTime = Util.dateFormate(data.trialTime, "YYYY-MM-DD")) ? (data.trialTime = Util.dateFormate(data.trialTime, "YYYY-MM-DD"))
: ""; : "";
data.processResult = null; data.processResult = null;
data.bizSceneInfo = JSON.stringify(this.buildBizSceneInfo(data.bizSceneCodes));
delete data.bizSceneCodes;
if (this.isAdd) {
data.approvalResult = 1;
}
this.$emit("handleAddConfirm", data, this.isAdd, this.index); this.$emit("handleAddConfirm", data, this.isAdd, this.index);
this.isAddDialogVisible(); this.isAddDialogVisible();
}, },
...@@ -351,23 +712,26 @@ export default { ...@@ -351,23 +712,26 @@ export default {
} }
this.isAdd = true; this.isAdd = true;
this.isAddDialogConfig.title = "新增试岗"; this.isAddDialogConfig.title = "新增试岗";
this.resetAddForm();
await this.fetchOnboardingPlans(); await this.fetchOnboardingPlans();
this.isAddVisible = !this.isAddVisible;
if (data) { if (data) {
this.isAddForm = deepClone(data); Object.assign(this.isAddForm, deepClone(data));
await this.prepareEditForm(this.isAddForm);
this.checkParams(this.isAddForm); this.checkParams(this.isAddForm);
this.updateParams(this.isAddForm); this.updateParams(this.isAddForm);
} }
this.openAddDialog();
}, },
async handleEdit(data, index) { async handleEdit(data, index) {
this.isAdd = false; this.isAdd = false;
this.index = index; this.index = index;
this.isAddDialogConfig.title = "编辑试岗"; this.isAddDialogConfig.title = "编辑试岗";
await this.fetchOnboardingPlans(); await this.fetchOnboardingPlans();
this.isAddVisible = !this.isAddVisible;
this.isAddForm = deepClone(data); this.isAddForm = deepClone(data);
await this.prepareEditForm(this.isAddForm);
this.checkParams(this.isAddForm); this.checkParams(this.isAddForm);
this.updateParams(this.isAddForm); this.updateParams(this.isAddForm);
this.openAddDialog();
}, },
handleResolve(data, index) { handleResolve(data, index) {
this.index = index; this.index = index;
...@@ -394,35 +758,61 @@ export default { ...@@ -394,35 +758,61 @@ export default {
if (!data) if (!data)
return; return;
const fields = [{ typeKey: "channelType", dataKey: "channelData" }]; const fields = [
{ typeKey: "channelType", dataKey: "channelData" },
{ typeKey: "storeNo", dataKey: "trialStoreData", optionId: "merchantId", optionLabel: "merchantName" },
{ typeKey: "residentType", dataKey: "residentTypeData" },
];
fields.forEach((field) => { fields.forEach((field) => {
const { typeKey, dataKey } = field; const { typeKey, dataKey } = field;
const optionId = field.optionId || "itemValue";
const optionLabel = field.optionLabel || "itemName";
const value = data[typeKey]; const value = data[typeKey];
if (typeKey === "storeNo" && value) {
this.ensureTrialStoreOption(data);
const exists = (this.baseData[dataKey] || []).some(
item => String(item[optionId]) === String(value),
);
if (!exists) {
data[typeKey] = "";
}
return;
}
const isValid = this.filterAttribute( const isValid = this.filterAttribute(
dataKey, dataKey,
"itemValue", optionId,
"itemName", optionLabel,
value, value,
); );
data[typeKey] = isValid ? value : ""; data[typeKey] = isValid ? value : "";
}); });
if (Array.isArray(data.bizSceneCodes)) {
this.$set(
data,
"bizSceneCodes",
this.normalizeBizSceneCodes(data.bizSceneCodes, this.baseData.bizSceneData),
);
}
}, },
updateParams(data) { updateParams(data) {
if (!data) if (!data)
return; return;
const fieldMap = { const fieldMap = {
channelType: "channelName", channelType: { nameKey: "channelName", optionId: "itemValue", optionLabel: "itemName" },
storeNo: { nameKey: "storeName", optionId: "merchantId", optionLabel: "merchantName" },
residentType: { nameKey: "residentTypeName", optionId: "itemValue", optionLabel: "itemName" },
}; };
Object.keys(fieldMap).forEach((typeKey) => { Object.keys(fieldMap).forEach((typeKey) => {
const nameKey = fieldMap[typeKey]; const { nameKey, optionId, optionLabel } = fieldMap[typeKey];
if (data[typeKey]) { if (data[typeKey]) {
const result = this.filterAttribute( const result = this.filterAttribute(
this.getDataKeyByType(typeKey), this.getDataKeyByType(typeKey),
"itemValue", optionId,
"itemName", optionLabel,
data[typeKey], data[typeKey],
); );
data[nameKey] = result || data[nameKey]; data[nameKey] = result || data[nameKey];
...@@ -433,11 +823,14 @@ export default { ...@@ -433,11 +823,14 @@ export default {
getDataKeyByType(typeKey) { getDataKeyByType(typeKey) {
const mapping = { const mapping = {
channelType: "channelData", channelType: "channelData",
storeNo: "trialStoreData",
residentType: "residentTypeData",
}; };
return mapping[typeKey] || ""; return mapping[typeKey] || "";
}, },
filterAttribute(optionsName, optionId, optionLabel, value) { filterAttribute(optionsName, optionId, optionLabel, value) {
let item = this.baseData[optionsName].find((item) => { const options = this.baseData[optionsName] || [];
let item = options.find((item) => {
return item[optionId] == value; return item[optionId] == value;
}); });
return item ? item[optionLabel] : ""; return item ? item[optionLabel] : "";
...@@ -510,10 +903,73 @@ export default { ...@@ -510,10 +903,73 @@ export default {
this.$emit("handleViewResult", data); this.$emit("handleViewResult", data);
}, },
isPendingTrial(item) { isPendingTrial(item) {
return item?.processResult === null return item?.processResult === null;
}, },
isProcessedTrial(item) { isProcessedTrial(item) {
return !this.isPendingTrial(item) return !this.isPendingTrial(item);
},
isPendingApproval(item) {
return item?.approvalResult === null;
},
isTrialApproved(item) {
return item?.approvalResult === 1 || item?.approvalResult === undefined;
},
canOperateTrial(item) {
return this.isTrialApproved(item);
},
handleApprove(item, index) {
this.$confirm(
"通过后当前试岗计划自动开通D+系统账号。确定是否确认?",
"提示",
{
confirmButtonText: "通过",
cancelButtonText: "取消",
type: "warning",
},
).then(() => {
trialOnboardingApproval({
id: item.id,
demandId: this.demandId,
approvalResult: 1,
}).then((res) => {
if (res) {
this.$message.success("操作成功");
this.$emit("handleApprovalSuccess", {
index,
data: res,
});
}
});
}).catch(() => {});
},
handleReject(item, index) {
this.approvalIndex = index;
this.approvalRecord = deepClone(item);
this.isRejectForm.approvalRemark = "";
this.isRejectVisible = true;
},
handleRejectClose() {
this.isRejectVisible = false;
this.isRejectForm.approvalRemark = "";
this.approvalIndex = null;
this.approvalRecord = {};
},
handleRejectConfirm(data) {
trialOnboardingApproval({
id: this.approvalRecord.id,
demandId: this.demandId,
approvalResult: 0,
approvalRemark: data.approvalRemark,
}).then((res) => {
if (res) {
this.$message.success("操作成功");
this.$emit("handleApprovalSuccess", {
index: this.approvalIndex,
data: res,
});
this.handleRejectClose();
}
});
}, },
handleDetailClose() { handleDetailClose() {
this.detailVisible = !this.detailVisible; this.detailVisible = !this.detailVisible;
......
...@@ -15,9 +15,12 @@ ...@@ -15,9 +15,12 @@
<trialOnboard <trialOnboard
ref="trialOnboard" ref="trialOnboard"
:trialOnboardings="detailInfo.trialOnboardings" :trialOnboardings="detailInfo.trialOnboardings"
:demand-id="id"
:businessType="detailInfo.businessType"
@handleAddConfirm="handleTrialConfirm" @handleAddConfirm="handleTrialConfirm"
@handleWorking="handleWorking" @handleWorking="handleWorking"
@handleViewResult="handleViewResult" @handleViewResult="handleViewResult"
@handleApprovalSuccess="handleApprovalSuccess"
:isBtn="isBtn" :isBtn="isBtn"
></trialOnboard> ></trialOnboard>
<!-- 入职计划 --> <!-- 入职计划 -->
...@@ -241,6 +244,10 @@ export default { ...@@ -241,6 +244,10 @@ export default {
this.detailInfo.trialOnboardings.splice(index, 1) this.detailInfo.trialOnboardings.splice(index, 1)
} }
} }
},
handleApprovalSuccess({ index, data }) {
if (!data || this.detailInfo.trialOnboardings[index] === undefined) return
this.$set(this.detailInfo.trialOnboardings, index, data)
} }
} }
} }
......
...@@ -177,7 +177,7 @@ import { ...@@ -177,7 +177,7 @@ import {
} from "@api/recruitment"; } from "@api/recruitment";
import { mapActions, mapState } from "vuex"; import { mapActions, mapState } from "vuex";
import { changeTypeOpt, connectionFlagOpt, connectionFlagOptMap, inviteStatusOpt, inviteStatusOptMap, trialStatusOpt } from "@/common/constants.js"; import { changeTypeOpt, connectionFlagOpt, connectionFlagOptMap, inviteStatusOpt, inviteStatusOptMap, trialStatusOpt,approvalStatusOpt } from "@/common/constants.js";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import reportTrackPageMixin from "@/mixins/reportTrackPageMixin"; import reportTrackPageMixin from "@/mixins/reportTrackPageMixin";
...@@ -347,12 +347,19 @@ export default { ...@@ -347,12 +347,19 @@ export default {
prop: "technicalSupervisorName", prop: "technicalSupervisorName",
width: 160, width: 160,
}, },
{ {
label: "所属省市", label: "所属省市",
prop: "provinceCity", prop: "provinceCity",
width: 160, width: 160,
}, },
{ {
label: "详细地址",
prop: "merchantAddressDetail",
width: 160,
},
{
label: "主营品牌", label: "主营品牌",
prop: "brand", prop: "brand",
width: 160, width: 160,
...@@ -408,6 +415,18 @@ export default { ...@@ -408,6 +415,18 @@ export default {
addHtml: "statusHtml", addHtml: "statusHtml",
}, },
{ {
label: "审批状态",
prop: "approvalStatus",
width: 120,
formatter: (cellValue) => {
const approvalStatusMap = {
0: "待审批",
2: "已审批",
};
return approvalStatusMap[cellValue.approvalStatus] || "-";
},
},
{
label: "试岗状态", label: "试岗状态",
prop: "trialStatus", prop: "trialStatus",
width: 120, width: 120,
...@@ -448,6 +467,7 @@ export default { ...@@ -448,6 +467,7 @@ export default {
technicalSupervisorName: "", technicalSupervisorName: "",
brand: "", brand: "",
connectionFlag: "", connectionFlag: "",
approvalStatus:""
}, },
showFormData: [ showFormData: [
{ {
...@@ -566,6 +586,16 @@ export default { ...@@ -566,6 +586,16 @@ export default {
optionLabel: "confValue", optionLabel: "confValue",
optionsName: "trialStatusOpt", optionsName: "trialStatusOpt",
}, },
{
label: "审批状态",
name: "approvalStatus",
type: "select",
isClear: true,
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "approvalStatusOpt",
},
], ],
baseData: { baseData: {
...@@ -585,6 +615,7 @@ export default { ...@@ -585,6 +615,7 @@ export default {
changeTypeOpt: deepClone(changeTypeOpt), changeTypeOpt: deepClone(changeTypeOpt),
receiverOpt: [], receiverOpt: [],
relateMerchantOpt: [], relateMerchantOpt: [],
approvalStatusOpt:deepClone(approvalStatusOpt)
}, },
isRejectDialogConfig: { isRejectDialogConfig: {
title: "驳回", title: "驳回",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!