|
@@ -89,7 +89,7 @@
|
|
|
<div class="form-select">
|
|
|
<ion-label>工作性质</ion-label>
|
|
|
<ion-select interface="action-sheet" placeholder="请选择工作性质" cancel-text="取消" name="workNatureID"
|
|
|
- id="workNatureID" v-model="dataModel.workNatureID" style="width: 100%;text-align: left;" @ionChange="onIsTrailChange">
|
|
|
+ id="workNatureID" v-model="dataModel.workNatureID" style="width: 100%;text-align: left;" >
|
|
|
<ion-select-option v-for="(record,key) in workNatureList" :key="key"
|
|
|
v-model:value="record.value">
|
|
|
{{ record.name }}
|
|
@@ -122,7 +122,7 @@
|
|
|
<div class="form-input">
|
|
|
<ion-label>试用期(月)</ion-label>
|
|
|
<ion-input :disabled="!dataModel.isTrail" type="number" placeholder="请输入试用期月数" label-placement="stacked"
|
|
|
- v-model="dataModel.trailMonths" class="custom">
|
|
|
+ v-model="dataModel.trailMonths" class="custom" @ionBlur="trailMonthsBlur">
|
|
|
</ion-input>
|
|
|
</div>
|
|
|
<div class="form-input">
|
|
@@ -218,6 +218,10 @@ interface StepParams{
|
|
|
loginUserID: string,
|
|
|
}
|
|
|
|
|
|
+interface postModel {
|
|
|
+ dataModel: any;
|
|
|
+}
|
|
|
+
|
|
|
export default defineComponent({
|
|
|
name: 'PostEdit',
|
|
|
components:{PostSelectionLike,WorkCategorySelection},
|
|
@@ -227,7 +231,7 @@ export default defineComponent({
|
|
|
const isShow = ref<any>(false);
|
|
|
const isEdit = ref<any>(false);
|
|
|
const isCommit = ref<any>(false);
|
|
|
- const formState = reactive({
|
|
|
+ const formState = reactive<postModel>({
|
|
|
dataModel: {
|
|
|
companyID:null,
|
|
|
professionName:null,
|
|
@@ -299,6 +303,73 @@ export default defineComponent({
|
|
|
formState.dataModel.workCategoryName = data.text;
|
|
|
}
|
|
|
|
|
|
+ const onSave = async function (){
|
|
|
+ isCommit.value = true;
|
|
|
+ const isFormCorrect = await v$.value.$validate();
|
|
|
+ console.log("当前岗位信息",formState.dataModel);
|
|
|
+ if (!isFormCorrect) {
|
|
|
+ await presentAlert('请输入完整信息!');
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ ifInputAllValid();
|
|
|
+ formState.dataModel.loginUserID = curStepData.value.loginUserID;
|
|
|
+ savePost(formState.dataModel).then(result=>{
|
|
|
+ if(result){
|
|
|
+ router.push({path: "./postList", query: {reload:1,id:formState.dataModel.companyID,status: 3}});
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const onResultInfo = (data: any)=>{
|
|
|
+ formState.dataModel.professionID = data.value;
|
|
|
+ formState.dataModel.professionName = data.text;
|
|
|
+ }
|
|
|
+
|
|
|
+ const onOpenPost = () => {
|
|
|
+ refPostSelectionLike.value.onOpen();
|
|
|
+ }
|
|
|
+
|
|
|
+ const back = () => {
|
|
|
+ router.push({path: "./postList", query: {reload:1,id:formState.dataModel.companyID,status: 2}});
|
|
|
+ }
|
|
|
+
|
|
|
+ const getWorkYearList = async function(){
|
|
|
+ const data :any = await getSysDictionaryList("WorkYearType");
|
|
|
+ workYearList.value = data;
|
|
|
+ console.log(workYearList.value);
|
|
|
+ }
|
|
|
+ const getCultureRankList = async function(){
|
|
|
+ const data:any = await getSysDictionaryList("CultureLevel");
|
|
|
+ cultureRankList.value = data;
|
|
|
+ console.log(cultureRankList.value);
|
|
|
+ }
|
|
|
+ const getWorkNationList = async function(){
|
|
|
+ const data:any = await getSysDictionaryList("WorkNature");
|
|
|
+ workNatureList.value = data;
|
|
|
+ }
|
|
|
+
|
|
|
+ const loadData = async (postID: any,companyID:any,loginUserID:any) => {
|
|
|
+ isCommit.value =false;
|
|
|
+ curStepData.value.loginUserID = loginUserID;
|
|
|
+ await getWorkYearList();
|
|
|
+ await getCultureRankList();
|
|
|
+ await getWorkNationList();
|
|
|
+ const reqData = await getPostByID(postID);
|
|
|
+ formState.dataModel = reqData;
|
|
|
+ formState.dataModel.companyID = companyID;
|
|
|
+ if(postID==null){
|
|
|
+ const curPostCompany :any = await getCompanyById(companyID,loginUserID);
|
|
|
+ formState.dataModel.welfare = curPostCompany.bonus;
|
|
|
+ }
|
|
|
+ console.log("初始化岗位信息",formState.dataModel);
|
|
|
+ };
|
|
|
+
|
|
|
+ const onIsTrailChange = ()=>{
|
|
|
+ if(!formState.dataModel.isTrail){
|
|
|
+ formState.dataModel.trailMonths = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
function isStringInteger(value: string) {
|
|
|
const n = parseInt(value, 10);
|
|
|
return n.toString() === value && Number.isInteger(n);
|
|
@@ -312,6 +383,17 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function trailMonthsBlur() {
|
|
|
+ if (formState.dataModel.trailMonths!= null) {
|
|
|
+ if(!isStringInteger(formState.dataModel.trailMonths)){
|
|
|
+ formState.dataModel.trailMonths = Math.floor(formState.dataModel.trailMonths);
|
|
|
+ if(parseInt(formState.dataModel.trailMonths)<0){
|
|
|
+ formState.dataModel.trailMonths = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const ifInputAllValid = ()=>{
|
|
|
let errorMessage = "";
|
|
|
let hasMinSalary = false;
|
|
@@ -386,68 +468,6 @@ export default defineComponent({
|
|
|
if(!isCommit.value){presentAlert(errorMessage);}
|
|
|
}
|
|
|
|
|
|
- const onSave = async function (){
|
|
|
- isCommit.value = true;
|
|
|
- const isFormCorrect = await v$.value.$validate();
|
|
|
- console.log("当前岗位信息",formState.dataModel);
|
|
|
- if (!isFormCorrect) {
|
|
|
- await presentAlert('请输入完整信息!');
|
|
|
- return null;
|
|
|
- }
|
|
|
- ifInputAllValid();
|
|
|
- formState.dataModel.loginUserID = curStepData.value.loginUserID;
|
|
|
- savePost(formState.dataModel).then(result=>{
|
|
|
- if(result){
|
|
|
- router.push({path: "./postList", query: {reload:1,id:formState.dataModel.companyID,status: 3}});
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- const onResultInfo = (data: any)=>{
|
|
|
- formState.dataModel.professionID = data.value;
|
|
|
- formState.dataModel.professionName = data.text;
|
|
|
- }
|
|
|
-
|
|
|
- const onOpenPost = () => {
|
|
|
- refPostSelectionLike.value.onOpen();
|
|
|
- }
|
|
|
-
|
|
|
- const back = () => {
|
|
|
- router.push({path: "./postList", query: {reload:1,id:formState.dataModel.companyID,status: 2}});
|
|
|
- }
|
|
|
-
|
|
|
- const getWorkYearList = async function(){
|
|
|
- const data :any = await getSysDictionaryList("WorkYearType");
|
|
|
- workYearList.value = data;
|
|
|
- console.log(workYearList.value);
|
|
|
- }
|
|
|
- const getCultureRankList = async function(){
|
|
|
- const data:any = await getSysDictionaryList("CultureLevel");
|
|
|
- cultureRankList.value = data;
|
|
|
- console.log(cultureRankList.value);
|
|
|
- }
|
|
|
-
|
|
|
- const getWorkNationList = async function(){
|
|
|
- const data:any = await getSysDictionaryList("WorkNature");
|
|
|
- workNatureList.value = data;
|
|
|
- }
|
|
|
-
|
|
|
- const loadData = async (postID: any,companyID:any,loginUserID:any) => {
|
|
|
- isCommit.value =false;
|
|
|
- curStepData.value.loginUserID = loginUserID;
|
|
|
- await getWorkYearList();
|
|
|
- await getCultureRankList();
|
|
|
- await getWorkNationList();
|
|
|
- const reqData = await getPostByID(postID);
|
|
|
- formState.dataModel = reqData;
|
|
|
- formState.dataModel.companyID = companyID;
|
|
|
- if(postID==null){
|
|
|
- const curPostCompany :any = await getCompanyById(companyID,loginUserID);
|
|
|
- formState.dataModel.welfare = curPostCompany.bonus;
|
|
|
- }
|
|
|
- console.log("初始化岗位信息",formState.dataModel);
|
|
|
- };
|
|
|
-
|
|
|
const reload = (postID: any,companyID:any,loginUserID:any) => {
|
|
|
formState.dataModel.recruitCount = null;
|
|
|
loadData(postID,companyID,loginUserID);
|
|
@@ -475,7 +495,9 @@ export default defineComponent({
|
|
|
refPostSelectionLike,
|
|
|
onOpenPost,
|
|
|
onResultInfo,
|
|
|
+ onIsTrailChange,
|
|
|
recruitCountBlur,
|
|
|
+ trailMonthsBlur,
|
|
|
onSetWorkCategoryID,
|
|
|
onSave,
|
|
|
back,
|