Browse Source

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

Xiao_123 9 months ago
parent
commit
6bd89f6356

+ 8 - 2
src/components/CtForm/index.vue

@@ -63,6 +63,13 @@
                 :item="item"
                 @change="handleChange(item)"
               ></nestedListGroupUI>
+              <datePickerUI
+                v-if="item.type === 'datePicker'"
+                v-model="item.value"
+                :item="item"
+                @change="handleChange(item)"
+              ></datePickerUI>
+              <DatePicker v-if="item.type === 'vueDatePicker'" v-model="item.value" :options="item.options" :width="item.width" :class="item.class"></DatePicker>
               <v-file-input
                 v-if="item.type === 'upload'"
                 :prepend-icon="item.prependIcon || ''"
@@ -90,8 +97,6 @@
                   <slot :name="item.selfAppend" :data="item.value"></slot>
                 </template>
               </v-file-input>
-              <DatePicker v-if="item.type === 'datePicker'" v-model="item.value" :options="item.options" :width="item.width" :class="item.class"></DatePicker>
-              
               <template v-if="item.slotName">
                 <slot :name="item.slotName" :item="item"></slot>
               </template>
@@ -114,6 +119,7 @@ import radioGroupUI from './../FormUI/radioGroup'
 import checkboxUI from './../FormUI/checkbox'
 import textareaUI from './../FormUI/textArea'
 import nestedListGroupUI from './../FormUI/nestedListGroup'
+import datePickerUI from './../FormUI/datePicker'
 import DatePicker from '@/components/DatePicker'
 import { ref, defineExpose } from 'vue'
 const emit = defineEmits(['change', 'inputUpdateAutocomplete'])// 定义一个或多个自定义事件

+ 126 - 19
src/components/FormUI/datePicker/index.vue

@@ -1,38 +1,145 @@
 <template>
   <div :style="{ width: item.width ? item.width + 'px' : '100%' }">
-    <v-date-input
+    <VueDatePicker
       v-model="value"
-      :label="item.label || '请选择'" 
-      variant="outlined"
-      prepend-icon=""
-      prepend-inner-icon="$calendar"
-      view-mode="month"
-      color="primary"
-      density="compact"
-      :disabled="item.disabled"
-      :rules="item.rules"
-      :hide-actions="true"
+      ref="datepicker"
+      :options="item.options || {}"
+      locale="zh-CN"
+      :disabled="item.disabled || false"
+      :range="item.range || false"
+      :model-type="timestamp"
+      :month-picker="month"
+      :time-picker="time"
+      :year-picker="year"
+      auto-apply
+      text-input
+      :show-now-button="item.showToday"
+      now-button-label="今天"
+      :enable-time-picker="item.enableTimePicker ?? false"
+      :clearable="item.clearable ?? true"
+      :day-names="['一', '二', '三', '四', '五', '六', '七']"
+      v-bind="$attrs"
+      :class="{'detailMargin': detailMargin}"
+      @open="handleOpen"
+      @closed="handleClosed"
       @update:modelValue="modelValueUpDate"
-    ></v-date-input>
+    >
+      <template #trigger>
+        <v-text-field
+          v-model="formatText"
+          variant="outlined"
+          :density="item.dense || 'compact'"
+          type="text"
+          :rules="rules"
+          :disabled="item.disabled"
+          :style="{width: item.width}"
+          :color="item.color || 'primary'"
+          :label="item.label"
+          :placeholder="item.placeholder || item.label"
+          :autofocus="item.autofocus"
+          :required="item.required"
+          :suffix="item.suffix"
+          :append-icon="item.appendIcon"
+          :append-inner-icon="item.appendInnerIcon"
+          :clearable="item.clearable"
+          :readonly="item.readonly"
+          :counter="item.counter"
+          :prepend-inner-icon="item.prependInnerIcon"
+          hide-spin-buttons
+          :class="item.class"
+          :hide-details="hideDetails || false"
+          @click:clear="handleClear"
+          @click="inputClick"
+          @blur="inputBlur"
+        ></v-text-field>
+      </template>
+    </VueDatePicker>
   </div>
 </template>
 <script setup>
-import { ref, watch } from 'vue';
-defineOptions({ name:'FormUI-v-date-input'})
+import { timesTampChange } from '@/utils/date'
+import { computed, ref, watch } from 'vue'
+defineOptions({ name:'FormUI-v-text-field'})
 
-const props = defineProps({item: Object, modelValue: String})
-const emit = defineEmits(['update:modelValue'])
+const props = defineProps({item: Object})
+const emit = defineEmits(['update:modelValue', 'change'])
 const item = props.item
+
 const value = ref(props.modelValue)
 
-watch(() => props.modelValue, (newVal) => {
-  value.value = newVal
+watch(() => item.value, (newVal) => {
+  value.value = newVal - 0
+  if (value.value) getFormatText()
 })
+
+const timestamp = 'timestamp' // 固定不能变
+// const datepicker = ref()
+const formatText = ref('')
+
 const modelValueUpDate = (val) => {
   value.value = val
+  getFormatText()
   emit('update:modelValue', value.value)
+  emit('change', value.value)
 }
+
+const getFormatText = () => {
+  const format = item.format || 'Y-M-D'
+  formatText.value = timesTampChange(value.value, format)
+}
+
+const handleClear = () => {
+  value.value = null
+  emit('change', value.value)
+}
+
+const rules = ref(item.rules)
+const handleOpen = () => {
+  rules.value = []
+}
+const handleClosed = () => {
+  rules.value = item.rules
+}
+
+const hideDetails = ref(item.hideDetails || false)
+const detailMargin = ref(false)
+const inputClick = () => {
+  if (item.hideDetails) return
+  hideDetails.value = true
+  detailMargin.value = true
+}
+// const inputFocus = () => {
+//   if (item.hideDetails) return
+//   hideDetails.value = true
+//   detailMargin.value = true
+// }
+const inputBlur = () => {
+  if (item.hideDetails) return
+  hideDetails.value = item.hideDetails || false
+  detailMargin.value = false
+}
+
+// dateType: 默认 date, 即年月日
+const year = computed(() => {
+  return item.dateType === 'year'
+})
+const month = computed(() => {
+  return item.dateType === 'month'
+})
+const time = computed(() => {
+  return item.dateType === 'time'
+})
+
+if (!item.format) item.format = year.value ? 'Y' : month.value ? 'Y-M' : time.value ? 'Y-M-D h:m:s' : 'Y-M-D'
+if (item.value) value.value = item.value - 0; getFormatText()
 </script>
 <style lang="scss" scoped>
-
+// .removeDetailHeight {}
+::v-deep .dp--menu-wrapper {
+  // top: 50px !important;
+  left: 0 !important;
+}
+.detailMargin {
+  margin-bottom: 22px;
+}
 </style>

+ 19 - 6
src/layout/personal/navBar.vue

@@ -19,8 +19,8 @@
           </div>
           <div class="nav">
             <ul>
-              <li v-for="k in list" :key="k.text">
-                <a :href="k.path" style="font-size: 14px;">{{ k.text }}</a>
+              <li v-for="(k, listIndex) in list" :key="k.text">
+                <a :href="k.path" style="font-size: 14px;" :class="{'routeActive': listIndex === routeActive}">{{ k.text }}</a>
               </li>
             </ul>
           </div>
@@ -110,12 +110,13 @@
 </template>
 
 <script setup>
-import { onMounted, ref } from 'vue'
+import { computed, onMounted, ref } from 'vue'
 import { getToken } from '@/utils/auth'
 import { useUserStore } from '@/store/user'
 // import { useLocaleStore } from '@/store/locale'
 import { useI18n } from '@/hooks/web/useI18n'
 import CtDialog from '@/components/CtDialog'
+import { useRoute } from 'vue-router'; const route = useRoute()
 import { useRouter } from 'vue-router'; const router = useRouter()
 import { getUserBindEnterpriseList, getUserRegisterEnterpriseApply } from '@/api/personal/user'
 import MessageNotification from '../message.vue'
@@ -145,12 +146,24 @@ const { t } = useI18n()
 // const localeStore = useLocaleStore()
 const userStore = useUserStore()
 
+const paths = [
+  '/recruitHome',
+  '/recruit/personal/position',
+  '/recruit/personal/company'
+  ]
 const list = ref([
-  { text: t('common.home'), path: '/recruitHome' },
-  { text: t('common.position'), path: '/recruit/personal/position' },
-  { text: t('common.company'), path: '/recruit/personal/company' }
+  { text: t('common.home'), path: paths[0] },
+  { text: t('common.position'), path: paths[1] },
+  { text: t('common.company'), path: paths[2] }
 ])
 
+const routeActive = computed(() => {
+  const index = list.value.findIndex(e => e.path === route.path)
+  console.log('index', index)
+  console.log('1', route.path)
+  return index
+})
+
 const handleLogoClick = () => { window.open('/') } // 点击logo
 const handleSubmit = () => { toEnterprise(radios.value) }
 

+ 5 - 0
src/styles/personal/navBar.scss

@@ -92,6 +92,11 @@
   text-decoration: none;
   color: var(--v-primary-base);
 }
+.routeActive {
+  text-decoration: underline !important;
+  // color: darkblue !important;
+  color: var(--v-error-base) !important;
+}
 .user-nav {
   // position: absolute;
   // right: 0;

+ 2 - 14
src/utils/prefixUrl.js

@@ -22,21 +22,9 @@ export const getSuffixAfterPrefix = (str) => {
 // 展示积分
 export function showNextAction (list) { // , currentIndex = 0
   const arr = list.reduce((newArr, action) => {
-    if (action.match) newArr.push(`+${action.point}  恭喜您【${action.title}】获得${action.point}积分`)
+    // if (action.match) newArr.push(`+${action.point}  恭喜您【${action.title}】获得${action.point}积分`)
+    if (action.match) newArr.push(`+${action.point}  恭喜您获得${action.point}积分`)
     return newArr
   }, [])
   if (arr?.length) Curtain('point', { list: arr })
-  // if (currentIndex < list.length) {
-  //   const action = list[currentIndex]
-  //   if (action.match) {
-  //     Snackbar.point(`+${action.point}  恭喜您${action.title}获得${action.point}积分`)
-  //     setTimeout(() => {
-  //       showNextAction(list, currentIndex + 1)
-  //     }, 3000)
-  //   } else {
-  //     setTimeout(() => {
-  //       showNextAction(list, currentIndex + 1)
-  //     }, 0)
-  //   }
-  // }
 }

+ 5 - 8
src/views/recruit/enterprise/informationManagement/informationSettingsComponents/basicInfo.vue

@@ -139,17 +139,14 @@ const formItems = ref({
     {
       type: 'datePicker',
       key: 'openTime',
+      dateType: 'date', // 时间类型 year month date time
       value: null,
+      label: '开业时间 *',
       col: 6,
-      class: 'mb-3',
       flexStyle: 'mr-3',
-      rules: [v => !!v || '请选择开业时间'],
-      options: {
-        type: 'date',
-        format: 'timestamp',
-        placeholder: '开业时间 *',
-        clearable: false
-      },
+      outlined: true,
+      rules: [v => !!v || '请选择开业时间']
+      // options: {},
     },
     {
       slotName: 'prepare',

+ 4 - 7
src/views/recruit/enterprise/informationManagement/informationSettingsComponents/businessInformation.vue

@@ -56,17 +56,14 @@ const formItems = ref({
     {
       type: 'datePicker',
       key: 'establishmentTime',
+      dateType: 'date', // 时间类型 year month date time
       value: null,
-      default: null,
+      label: '成立时间 *',
       col: 6,
       flexStyle: 'mr-3',
-      class: 'mb-3',
-      options: {
-        // type: 'month',
-        format: 'timestamp',
-        placeholder: '成立时间 *',
-      },
+      outlined: true,
       rules: [v => !!v || '请选择成立时间']
+      // options: {},
     },
     {
       type: 'text',

+ 4 - 5
src/views/recruit/enterprise/positionManagement/components/baseInfo.vue

@@ -169,13 +169,12 @@ const items = ref({
     {
       type: 'datePicker',
       key: 'expireTime',
+      dateType: 'date', // 时间类型 year month date time
       value: null,
-      class: 'mb-3',
-      options: {
-        format: 'timestamp',
-        placeholder: '到期时间 *',
-      },
+      label: '到期时间 *',
+      outlined: true,
       rules: [v => !!v || '请选择到期时间']
+      // options: {},
     },
     {
       type: 'textarea',

+ 1 - 1
src/views/recruit/enterprise/talentPool/components/filter.vue

@@ -135,7 +135,7 @@ const formItems = ref({
       label: '期望城市'
     },
     {
-      type: 'datePicker',
+      type: 'vueDatePicker',
       key: 'firstWorkTime',
       value: null,
       default: null,

+ 10 - 17
src/views/recruit/personal/remuse/components/basicInfo.vue

@@ -192,18 +192,13 @@ const items = ref({
     {
       type: 'datePicker',
       key: 'birthday',
+      // dateType: 'date', // 时间类型 year month date time
       value: null,
-      default: null,
+      label: '出生日期 *',
       col: 6,
-      class: 'mb-3',
-      rules: [v => !!v || '请选择出生日期'],
-      options: {
-        type: 'date',
-        format: 'timestamp',
-        placeholder: '出生日期 *',
-        clearable: false,
-        // disabled: true,
-      },
+      outlined: true,
+      rules: [v => !!v || '请选择出生日期']
+      // options: {},
     },
     {
       type: 'phoneNumber',
@@ -338,17 +333,15 @@ const items = ref({
     },
     {
       type: 'datePicker',
+      dateType: 'month',
       key: 'firstWorkTime',
       value: null,
-      default: null,
+      label: '首次工作时间 *',
       col: 6,
-      class: 'mb-3',
-      options: {
-        type: 'month',
-        format: 'timestamp',
-        placeholder: '首次工作时间 *',
-      },
+      outlined: true,
+      // clearable: true,
       rules: [v => !!v || '请选择首次工作时间']
+      // options: {},
     },
   ]
 })

+ 10 - 14
src/views/recruit/personal/remuse/components/educationExp.vue

@@ -154,30 +154,26 @@ const formItems = ref({
     {
       type: 'datePicker',
       key: 'startTime',
+      dateType: 'month', // 时间类型 year month date time
       value: null,
-      default: null,
+      label: '起始时间 *',
       col: 6,
-      class: 'mb-3',
-      options: {
-        type: 'month',
-        format: 'timestamp',
-        placeholder: '起始时间 *',
-      },
+      outlined: true,
+      clearable: true,
       rules: [v => !!v || '请选择起始时间']
+      // options: {},
     },
     {
       type: 'datePicker',
       key: 'endTime',
+      dateType: 'month', // 时间类型 year month date time
       value: null,
-      default: null,
+      label: '结束时间 *',
       col: 6,
-      class: 'mb-3',
-      options: {
-        type: 'month',
-        format: 'timestamp',
-        placeholder: '结束时间 *',
-      },
+      outlined: true,
+      clearable: true,
       rules: [v => !!v || '请选择结束时间']
+      // options: {},
     },
     {
       type: 'textarea',

+ 11 - 12
src/views/recruit/personal/remuse/components/projectExperience.vue

@@ -63,29 +63,28 @@ const items = ref({
     {
       type: 'datePicker',
       key: 'startTime',
+      dateType: 'month', // 时间类型 year month date time
       value: null,
+      label: '项目开始时间 *',
       col: 6,
-      class: 'mb-3',
-      options: {
-        type: 'month',
-        format: 'timestamp',
-        placeholder: '项目开始时间 *',
-      },
       flexStyle: 'mr-3',
+      outlined: true,
+      clearable: true,
       rules: [v => !!v || '请选择项目开始时间']
+      // options: {},
     },
     {
       type: 'datePicker',
       key: 'endTime',
+      dateType: 'month', // 时间类型 year month date time
       value: null,
+      label: '项目结束时间 *',
       col: 6,
-      class: 'mb-3',
-      options: {
-        type: 'month',
-        format: 'timestamp',
-        placeholder: '项目结束时间 *',
-      },
+      flexStyle: 'mr-3',
+      outlined: true,
+      clearable: true,
       rules: [v => !!v || '请选择项目结束时间']
+      // options: {},
     },
     {
       type: 'textarea',

+ 10 - 12
src/views/recruit/personal/remuse/components/trainingExperience.vue

@@ -78,29 +78,27 @@ const items = ref({
     {
       type: 'datePicker',
       key: 'startTime',
+      dateType: 'month', // 时间类型 year month date time
       value: null,
+      label: '培训开始时间 *',
       col: 6,
-      class: 'mb-3',
-      options: {
-        type: 'month',
-        format: 'timestamp',
-        placeholder: '培训开始时间 *',
-      },
       flexStyle: 'mr-3',
+      outlined: true,
+      clearable: true,
       rules: [v => !!v || '请选择培训开始时间']
+      // options: {},
     },
     {
       type: 'datePicker',
       key: 'endTime',
+      dateType: 'month', // 时间类型 year month date time
       value: null,
+      label: '培训结束时间 *',
       col: 6,
-      class: 'mb-3',
-      options: {
-        type: 'month',
-        format: 'timestamp',
-        placeholder: '培训结束时间 *',
-      },
+      outlined: true,
+      clearable: true,
       rules: [v => !!v || '请选择培训结束时间']
+      // options: {},
     },
     {
       type: 'textarea',

+ 10 - 14
src/views/recruit/personal/remuse/components/workExperience.vue

@@ -120,30 +120,26 @@ const formItems = ref({
     {
       type: 'datePicker',
       key: 'startTime',
+      dateType: 'month', // 时间类型 year month date time
       value: null,
-      default: null,
+      label: '起始时间 *',
       col: 6,
-      class: 'mb-3',
-      options: {
-        type: 'month',
-        format: 'timestamp',
-        placeholder: '起始时间 *',
-      },
+      outlined: true,
+      clearable: true,
       rules: [v => !!v || '请选择起始时间']
+      // options: {},
     },
     {
       type: 'datePicker',
       key: 'endTime',
+      dateType: 'month', // 时间类型 year month date time
       value: null,
-      default: null,
+      label: '结束时间 *',
       col: 6,
-      class: 'mb-3',
-      options: {
-        type: 'month',
-        format: 'timestamp',
-        placeholder: '结束时间 *',
-      },
+      outlined: true,
+      clearable: true,
       rules: [v => !!v || '请选择结束时间']
+      // options: {},
     },
     {
       type: 'textarea',