From 56aa0125b8b1932cf4fdb3fb3e7e6d3249d8a543 Mon Sep 17 00:00:00 2001 From: kaeery <3491123437@qq.com> Date: Thu, 6 Mar 2025 21:00:02 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=8B=9B=E7=94=9F=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E3=80=91=20=E4=BC=98=E5=8C=96#=20=E4=B8=BB=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7-=E4=B8=AA=E4=BA=BA=EF=BC=9A=E5=B0=81=E8=A3=85?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/clue-list/components/date-popup.vue | 58 ++ src/bundle/pages/clue-list/index.vue | 56 +- src/bundle/pages/rank-list/index.vue | 43 +- .../personally/components/dropdown-picker.vue | 170 +++++ .../personally/components/position-tabs.vue | 1 - .../personally/components/telesale-card.vue | 4 +- .../widgets/admin/personally/index.vue | 151 +---- src/components/widgets/admin/team/index.vue | 163 +---- src/hooks/useCommon.ts | 4 +- .../uview-plus/components/u-popup/popup.js | 3 +- .../uview-plus/components/u-popup/props.js | 4 + .../uview-plus/components/u-popup/u-popup.vue | 587 +++++++++--------- 12 files changed, 647 insertions(+), 597 deletions(-) create mode 100644 src/bundle/pages/clue-list/components/date-popup.vue create mode 100644 src/components/widgets/admin/personally/components/dropdown-picker.vue diff --git a/src/bundle/pages/clue-list/components/date-popup.vue b/src/bundle/pages/clue-list/components/date-popup.vue new file mode 100644 index 0000000..d603abf --- /dev/null +++ b/src/bundle/pages/clue-list/components/date-popup.vue @@ -0,0 +1,58 @@ + + + + diff --git a/src/bundle/pages/clue-list/index.vue b/src/bundle/pages/clue-list/index.vue index 32f1378..e1c737d 100644 --- a/src/bundle/pages/clue-list/index.vue +++ b/src/bundle/pages/clue-list/index.vue @@ -1,6 +1,6 @@ @@ -44,10 +45,13 @@ import { onLoad } from '@dcloudio/uni-app' import { ref, shallowRef } from 'vue' import clueCard from './components/clue-card.vue' +import datePopup from './components/date-popup.vue' import { useZPaging } from '@/hooks/useZPaging' import { apiTeleClueList } from '@/api/clue' import { computed } from 'vue' import { debounce } from 'lodash-es' +import { nextTick } from 'vue' +import { formatDate, formateDate, getCurDate } from '@/utils/util' const queryParams = ref({ likeWork: '' @@ -83,13 +87,47 @@ const searchChange = debounce(() => { }, 300) const type = ref('') -onLoad(option => { - if (option.id) { - uni.setNavigationBarTitle({ - title: '张三' - }) - type.value = option.type ?? '' - } +const dateTagFlag = ref('') +onLoad(async options => { + setFormData(options) + dateTagFlag.value = options?.dateTag ?? '' + await nextTick() + datePopupRef.value?.setDefaultValue({ ...form.value, dateTag: dateTagFlag.value }) + // if (option.id) { + // uni.setNavigationBarTitle({ + // title: '张三' + // }) + type.value = options.type ?? '' + // } }) +const form = ref() +// 设置表单数据 +const setFormData = options => { + form.value = Object.keys(options).reduce((acc, key) => { + if (key == 'id' || key == 'dateTag' || key == 'type') { + return acc + } + acc[key] = decodeURIComponent(options[key]) + return acc + }, {}) +} + +const datePopupRef = ref>() +const handleShowPopup = () => { + datePopupRef.value?.openPopup() +} +const handleConfirmDate = (date: { [key: string]: string }) => { + const { start, end } = date + form.value.createTimeStart = formateDate(start, 'start', 'YYYY-MM-DD') + form.value.createTimeEnd = formateDate(end, 'end', 'YYYY-MM-DD') + datePopupRef.value?.handleToggle(true) +} +const handleResetDate = () => { + form.value.createTimeStart = getCurDate('start', 'YYYY-MM-DD') + form.value.createTimeEnd = getCurDate('end', 'YYYY-MM-DD') + console.log(form.value) + + datePopupRef.value?.handleToggle(true) +} diff --git a/src/bundle/pages/rank-list/index.vue b/src/bundle/pages/rank-list/index.vue index 4cb9aed..94f2ff9 100644 --- a/src/bundle/pages/rank-list/index.vue +++ b/src/bundle/pages/rank-list/index.vue @@ -1,5 +1,5 @@ @@ -45,7 +55,7 @@ import { IForm } from '@/components/widgets/admin/team/index.vue' const dropdownPickerRef = ref>() const form = ref() -const { tabs, activeTab, columns, data, loading, rankStyle, handleChangeTab, fetchData } = useRank({ +const { tabs, columns, data, loading, rankStyle, handleChangeTab, fetchData } = useRank({ width: 160, callback: () => { fetchData(form.value) @@ -63,6 +73,7 @@ onLoad(async options => { ) fetchData(form.value) }) +// 设置表单数据 const setFormData = options => { form.value = Object.keys(options).reduce((acc, key) => { if (key == 'dropdownIndex' || key == 'dateTag') { diff --git a/src/components/widgets/admin/personally/components/dropdown-picker.vue b/src/components/widgets/admin/personally/components/dropdown-picker.vue new file mode 100644 index 0000000..e1da958 --- /dev/null +++ b/src/components/widgets/admin/personally/components/dropdown-picker.vue @@ -0,0 +1,170 @@ + + + + diff --git a/src/components/widgets/admin/personally/components/position-tabs.vue b/src/components/widgets/admin/personally/components/position-tabs.vue index ff87bd4..dfcd765 100644 --- a/src/components/widgets/admin/personally/components/position-tabs.vue +++ b/src/components/widgets/admin/personally/components/position-tabs.vue @@ -35,7 +35,6 @@ const handleCellClick = (item: any) => { const { id } = item postId.value = id emit('update:modelValue', id) - emit('confirm', item) } const handleReset = () => { postId.value = 0 diff --git a/src/components/widgets/admin/personally/components/telesale-card.vue b/src/components/widgets/admin/personally/components/telesale-card.vue index ea70703..b50c3e5 100644 --- a/src/components/widgets/admin/personally/components/telesale-card.vue +++ b/src/components/widgets/admin/personally/components/telesale-card.vue @@ -32,7 +32,9 @@ {{ parseText(key) }}数据 查看 - + - - - - - - - - - - - - - - - - - - - + + > --> + + diff --git a/src/components/widgets/admin/team/index.vue b/src/components/widgets/admin/team/index.vue index 0c8a966..c1badf6 100644 --- a/src/components/widgets/admin/team/index.vue +++ b/src/components/widgets/admin/team/index.vue @@ -6,51 +6,6 @@ @refresh-page="refreshPage" @confirm="confirm" /> - @@ -65,12 +20,9 @@ import dataOverview from './components/data-overview.vue' import convertedOverview from './components/converted-overview.vue' import rank from './components/rank.vue' import clueStatus from './components/clue-status.vue' -import dateDropdownPicker from '@/components/date-dropdown/daterange.vue' import dropdownPicker from '../dropdown-picker.vue' -import selectDropdown from '@/components/select-dropdown/index.vue' import filterValue from '../filter-value.vue' -import { apiOrganizationByIdList, apiOrganizationList, apiOrganizationTeamList } from '@/api/admin' -import { formateDate, getCurDate } from '@/utils/util' +import { getCurDate } from '@/utils/util' import { AdminTabEnum } from '@/enums' export interface IForm { @@ -78,6 +30,7 @@ export interface IForm { createTimeStart: string createTimeEnd: string userId: string + postId?: number } defineProps({ @@ -87,44 +40,17 @@ defineProps({ } }) const dropdownPickerRef = ref>() -const teamDropdownRef = ref>() -const orgDropdownRef = ref>() const clueStatusRef = ref>() const rankRef = ref>() const convertedOverviewRef = ref>() const dataOverviewRef = ref>() -const uDropdownRef = ref() const organizationList = ref([]) -const defaultValue = ref() //保存组织默认值 const form = ref({ organizationId: null, createTimeStart: getCurDate('start'), createTimeEnd: getCurDate('end'), userId: '' }) -const dropdownMenuDateList = { - showQuick: true, - title: '日期范围', - type: 'daterange', - prop: 'god6', - value: { start: getCurDate('start', 'YYYY-MM-DD'), end: getCurDate('end', 'YYYY-MM-DD') } -} -const dropdownMenuTeamList = ref({ - title: '下拉', - type: 'cell', - prop: 'god1', - showAll: true, - showIcon: true, - options: [] -}) -const dropdownMenuAllOrgaList = ref({ - title: '下拉', - type: 'cell', - prop: 'god1', - showAll: true, - showIcon: true, - options: [] -}) const menuIndexArr = ref([]) const refreshPage = () => { fetchAllData() @@ -133,55 +59,10 @@ const confirm = payload => { menuIndexArr.value = Array.from(new Set([...menuIndexArr.value, payload.dropdownIndex])) rankRef.value?.setSelectedIndexArr(menuIndexArr.value, payload?.dateTag) } -// 查询条件 -const handleConfirm = (type: string, item, dropdownIndex: number, dateTag?: string) => { - switch (type) { - case 'organization': - case 'team': - // 清空选择条件 - dropdownIndex == 1 - ? orgDropdownRef.value.clearSelect() - : teamDropdownRef.value.clearSelect() - form.value.organizationId = item.value - break - case 'date': - form.value.createTimeStart = formateDate(item.start, 'start') - form.value.createTimeEnd = formateDate(item.end, 'end') - break - default: - break - } - fetchAllData() - closeDropDown() - menuIndexArr.value = Array.from(new Set([...menuIndexArr.value, dropdownIndex])) - rankRef.value?.setSelectedIndexArr(menuIndexArr.value, dateTag) -} -// 重置条件 -const handleReset = (type: string) => { - switch (type) { - case 'organization': - break - case 'date': - form.value.createTimeStart = getCurDate('start') - form.value.createTimeEnd = getCurDate('end') - break - case 'team': - form.value.organizationId = defaultValue.value - break - default: - break - } - fetchAllData() - closeDropDown() -} -const closeDropDown = () => { - uDropdownRef.value.close() -} const refreshData = () => { rankRef.value?.fetchData(form.value) } onMounted(async () => { - // await fetchOrganizationList() await dropdownPickerRef.value?.fetchOrganizationList() organizationList.value = dropdownPickerRef.value?.organizationList fetchAllData() @@ -192,45 +73,5 @@ const fetchAllData = () => { rankRef.value?.fetchData(form.value) clueStatusRef.value?.fetchData(form.value) } -// 获取主账号下的所有组织架构 -const fetchOrganizationList = async () => { - try { - const result = await apiOrganizationList() - organizationList.value = result ?? [] - if (result.length > 0) { - form.value.organizationId = result[0].id - defaultValue.value = result[0].id - } - } catch (error) {} -} -// 获取团队列表 -const fetchTeamList = async () => { - try { - const result = await apiOrganizationTeamList() - dropdownMenuTeamList.value.options = - result.map(item => { - return { - label: item.name, - value: item.id - } - }) ?? [] - } catch (error) {} -} -// 获取组织列表 -const fetchAllOrganizationList = async () => { - try { - const result = await apiOrganizationByIdList() - dropdownMenuAllOrgaList.value.options = - result.map(item => { - return { - label: item.name, - value: item.id - } - }) ?? [] - } catch (error) {} -} - -// fetchTeamList() -// fetchAllOrganizationList() diff --git a/src/hooks/useCommon.ts b/src/hooks/useCommon.ts index c65f4a3..e35c0d9 100644 --- a/src/hooks/useCommon.ts +++ b/src/hooks/useCommon.ts @@ -115,7 +115,7 @@ export function useRank({ width, callback }: { width: number; callback?: () => v // 岗位 export function usePositions() { const positionList = ref() - const postId = ref() + const postId = ref(0) const fetchPositions = async () => { try { const result = await postLists() @@ -126,7 +126,7 @@ export function usePositions() { value: item.id } }) - if (positionList.value.length > 0) postId.value = positionList.value[0].id + // if (positionList.value.length > 0) postId.value = positionList.value[0].id } catch (error) {} } diff --git a/src/uni_modules/uview-plus/components/u-popup/popup.js b/src/uni_modules/uview-plus/components/u-popup/popup.js index 5440c3c..3c95fc7 100644 --- a/src/uni_modules/uview-plus/components/u-popup/popup.js +++ b/src/uni_modules/uview-plus/components/u-popup/popup.js @@ -24,6 +24,7 @@ export default { round: 0, zoom: true, bgColor: '', - overlayOpacity: 0.5 + overlayOpacity: 0.5, + top: 0 } } diff --git a/src/uni_modules/uview-plus/components/u-popup/props.js b/src/uni_modules/uview-plus/components/u-popup/props.js index 78e976b..aba0bb9 100644 --- a/src/uni_modules/uview-plus/components/u-popup/props.js +++ b/src/uni_modules/uview-plus/components/u-popup/props.js @@ -76,6 +76,10 @@ export const props = defineMixin({ overlayOpacity: { type: [Number, String], default: () => defProps.popup.overlayOpacity + }, + top: { + type: Number, + default: () => defProps.popup.top } } }) diff --git a/src/uni_modules/uview-plus/components/u-popup/u-popup.vue b/src/uni_modules/uview-plus/components/u-popup/u-popup.vue index ce83c97..849970b 100644 --- a/src/uni_modules/uview-plus/components/u-popup/u-popup.vue +++ b/src/uni_modules/uview-plus/components/u-popup/u-popup.vue @@ -1,310 +1,319 @@