|
@@ -19,11 +19,10 @@
|
|
|
</view>
|
|
|
</uni-forms-item>
|
|
|
<uni-forms-item label="岗位职责" name="content" required>
|
|
|
- <uni-easyinput type="textarea" v-model="formData.content" autoHeight placeholder="请输入内容"></uni-easyinput>
|
|
|
- <!-- <RichEditor @blur="richEditorBlur" :richValue="formData.content" /> -->
|
|
|
+ <RichEditor ref="contentRef" :richValue="formData.content" @blur="val => editorBlur('content', val)" :max="1500" />
|
|
|
</uni-forms-item>
|
|
|
<uni-forms-item label="岗位要求 " name="requirement" required>
|
|
|
- <uni-easyinput type="textarea" v-model="formData.requirement" autoHeight placeholder="请输入内容"></uni-easyinput>
|
|
|
+ <RichEditor ref="requirementRef" :richValue="formData.requirement" @blur="val => editorBlur('requirement', val)" :max="1500" />
|
|
|
</uni-forms-item>
|
|
|
</uni-forms>
|
|
|
<!-- 确认框 -->
|
|
@@ -31,7 +30,7 @@
|
|
|
<uni-popup-dialog
|
|
|
type="warn"
|
|
|
cancelText="取消"
|
|
|
- confirmText="确认"
|
|
|
+ confirmText="确认"
|
|
|
title="系统提示"
|
|
|
content="您确定要放弃目前岗位描述的内容吗?"
|
|
|
@confirm="handleConfirm"
|
|
@@ -46,7 +45,7 @@ import { dictObj } from '@/utils/position.js'
|
|
|
import { getNextDate } from '@/utils/date'
|
|
|
import { getRecruitPositionDetails } from '@/api/new/position'
|
|
|
import { dateToTimestamp } from '@/utils/date.js'
|
|
|
-// import RichEditor from '@/components/RichEditor'
|
|
|
+import RichEditor from '@/components/RichEditor'
|
|
|
const props = defineProps({
|
|
|
data: {
|
|
|
type: Object,
|
|
@@ -56,8 +55,7 @@ const props = defineProps({
|
|
|
|
|
|
const formData = ref({
|
|
|
positionId: props.data?.positionId || '',
|
|
|
- // name: props.data?.name || '',
|
|
|
- name: props.data?.name + new Date().getTime().toString() || '',
|
|
|
+ name: props.data?.name || '' + new Date().getTime().toString(), // + new Date().getTime().toString()
|
|
|
expireTime: props.data?.expireTime || getNextDate(15, 'YYYY-MM-DD', 'day'),
|
|
|
content: props.data?.content || '',
|
|
|
requirement: props.data?.requirement || ''
|
|
@@ -92,6 +90,10 @@ const rules = {
|
|
|
},
|
|
|
}
|
|
|
|
|
|
+const editorBlur = (key, val) => {
|
|
|
+ formData.value[key] = val || ''
|
|
|
+}
|
|
|
+
|
|
|
const pushTemplate = () => {
|
|
|
formData.value.content = jobTemplateRes.value.content
|
|
|
formData.value.requirement = jobTemplateRes.value.requirement
|
|
@@ -124,7 +126,6 @@ const useJobTemplate = async () => {
|
|
|
return
|
|
|
}
|
|
|
jobTemplateRes.value = res.data
|
|
|
- console.log('res.data:', res.data)
|
|
|
if (formData.value?.content || formData.value?.requirement) {
|
|
|
// 弹窗提示
|
|
|
confirm.value.open()
|
|
@@ -134,15 +135,16 @@ const useJobTemplate = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// const richEditorBlur = (content) => {
|
|
|
-// formData.value.content = content
|
|
|
-// }
|
|
|
-
|
|
|
const form = ref()
|
|
|
+const contentRef = ref()
|
|
|
+const requirementRef = ref()
|
|
|
const soFar = ref(props.data?.expireTime === null ? [1] : [])
|
|
|
const getQuery = async () => {
|
|
|
const valid = await unref(form).validate()
|
|
|
if (!valid) return
|
|
|
+ if (contentRef.value?.isExceedValidate(true, '岗位职责字数超出限制')) return
|
|
|
+ if (requirementValid.value?.isExceedValidate(true, '岗位要求字数超出限制')) return
|
|
|
+
|
|
|
const obj = {
|
|
|
hirePrice: 0,
|
|
|
soFar: Boolean(soFar.value?.length),
|
|
@@ -151,8 +153,6 @@ const getQuery = async () => {
|
|
|
}
|
|
|
obj.expireTime = obj.soFar ? null : dateToTimestamp(obj.expireTime)
|
|
|
obj && Object.keys(obj).length && Object.keys(obj).forEach(key => { if (['areaId', 'eduType', 'expType'].includes(key) && obj[key] === -1) obj[key] = null })
|
|
|
-
|
|
|
- console.log('基本信息:', obj)
|
|
|
return obj
|
|
|
}
|
|
|
|