From a6f6435da9d57e445501a47bdd7f2d4fc8221672 Mon Sep 17 00:00:00 2001 From: qiuyuan Date: Tue, 2 Sep 2025 10:09:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=99=BB=E8=AE=B0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/modules/vote.js | 18 ++ src/locales/lang/zh-CN/menu.js | 3 +- src/router/routes/pages.js | 12 + .../pages/activity/components/EditDialog.vue | 104 +++++-- .../pages/vote/components/EditDialog.vue | 251 +++++++++++++++ src/views/pages/vote/index.vue | 288 ++++++++++++++++++ src/views/pages/workOrder/orderList/index.vue | 6 +- 7 files changed, 645 insertions(+), 37 deletions(-) create mode 100644 src/apis/modules/vote.js create mode 100644 src/views/pages/vote/components/EditDialog.vue create mode 100644 src/views/pages/vote/index.vue diff --git a/src/apis/modules/vote.js b/src/apis/modules/vote.js new file mode 100644 index 0000000..d9b10de --- /dev/null +++ b/src/apis/modules/vote.js @@ -0,0 +1,18 @@ +/** + * 区域模块接口 + */ +import request from '@/utils/request' +// 获取项目列表 +export const getElectionList = (params) => request.basic.get('/api/v1/election-registrations', params) +// 获取单挑数据 +export const getItem = (id) => request.basic.get(`/api/v1/activities/${id}`) +// 添加条目 +export const createProject = (params) => request.basic.post('/api/v1/activities', params) +// 更新role +export const updateItem = (id, params) => request.basic.put(`/api/v1/activities/${id}`, params) +// 删除数据 +export const delItem = (id) => request.basic.delete(`/api/v1/activities/${id}`) +//获取活动报名列表 +export const getActivityList = (params) => request.basic.get('/api/v1/activity-registers', params) +// 导出文件 +export const exportFile = (params) => request.basic.get('/api/v1/election-registrations/export', params, { responseType: 'blob' }) \ No newline at end of file diff --git a/src/locales/lang/zh-CN/menu.js b/src/locales/lang/zh-CN/menu.js index 886c528..dfb9bb1 100644 --- a/src/locales/lang/zh-CN/menu.js +++ b/src/locales/lang/zh-CN/menu.js @@ -51,5 +51,6 @@ export default { customer:'用户管理', aiHelper:'AI助手', abbreviation:'活动报名', - orderArea:'工单区域管理' + orderArea:'工单区域管理', + vote:'信息登记' } diff --git a/src/router/routes/pages.js b/src/router/routes/pages.js index d16ecfa..e5f3a73 100644 --- a/src/router/routes/pages.js +++ b/src/router/routes/pages.js @@ -249,4 +249,16 @@ export default [ permission: '*', }, }, + { + path: 'vote/index', + name: 'vote', + component: 'pages/vote/index.vue', + meta: { + icon: 'icon-huodongliebiao-copy', + title: '信息登记', + isMenu: true, + keepAlive: true, + permission: '*', + }, + } ] diff --git a/src/views/pages/activity/components/EditDialog.vue b/src/views/pages/activity/components/EditDialog.vue index 37182a3..84f3ef3 100644 --- a/src/views/pages/activity/components/EditDialog.vue +++ b/src/views/pages/activity/components/EditDialog.vue @@ -18,22 +18,38 @@ - + - - + - - + @@ -41,7 +57,6 @@ style="width: 100%" /> - { - + // Initialize if needed }) /** @@ -108,7 +136,6 @@ function handleCreate() { type: 'create', title: '新增活动', }) - // initData() formData.value.status = 1 formData.value.maxSignupNum = 0 } @@ -129,9 +156,18 @@ async function handleEdit(record = {}) { return } hideSpining() - formData.value = { ...data } + + // 转换后端时间格式为组件需要的格式 + formData.value = { + ...data, + // 确保时间格式正确解析 + endSignupAt: data.endSignupAt ? dayjs(data.endSignupAt) : null, + startAt: data.startAt ? dayjs(data.startAt) : null, + endAt: data.endAt ? dayjs(data.endAt) : null + } + if (data.images && data.images.length > 0) { - formData.value.images = data.images.map(item => config('http.apiBasic') + item) + formData.value.images = data.images.map( item => config('http.apiBasic') + item) } else { formData.value.images = [] } @@ -144,11 +180,8 @@ async function handleEdit(record = {}) { message.error({ content: error.message }) hideSpining() } +} -} -const uploadSuccess = (data) => { - fileList.value.push(data) -} /** * 确定 */ @@ -156,14 +189,27 @@ function handleOk() { formRef.value.validateFields().then(async (values) => { try { showLoading() + + // 处理时间格式,确保符合要求 + const formatTime = (timeStr) => { + if (!timeStr) return null; + // 确保时间字符串正确转换为所需格式 + return dayjs(timeStr).format(valueFormat); + }; + const params = { ...values, maxSignupNum: parseInt(values.maxSignupNum) || 0, cover: formData.value.cover ? spliceUrl(formData.value.cover[0]) : '', images: formData.value.images ? formData.value.images.map(item => spliceUrl(item)) : [], signupNum: formData.value.signupNum || 0, - status: 1 + status: 1, + // 使用格式化后的时间 + endSignupAt: formatTime(values.endSignupAt), + startAt: formatTime(values.startAt), + endAt: formatTime(values.endAt) } + let result = null switch (modal.value.type) { case 'create': @@ -172,7 +218,7 @@ function handleOk() { }) break case 'edit': - result = await apis.activity.updateItem(formData.value.id, params).catch(() => { + result = await apis.activity.updateItem(formData.value.id, params).catch((error) => { throw new Error(error) }) break @@ -187,12 +233,11 @@ function handleOk() { hideLoading() } }) - .catch((e) => { - hideLoading() - }) + .catch((e) => { + hideLoading() + }) } - /** * 取消 */ @@ -200,13 +245,6 @@ function handleCancel() { formData.value.areaId = 1 hideModal() } -const onRangeChange = (value, dateString) => { - console.log('value', value) - console.log('Formatted Selected Time: ', dateString); - formData.value.startAt = dayjs(dateString[0]) - formData.value.endAt = dayjs(dateString[1]) - console.log(formData.value) -}; /** * 关闭后 diff --git a/src/views/pages/vote/components/EditDialog.vue b/src/views/pages/vote/components/EditDialog.vue new file mode 100644 index 0000000..8578797 --- /dev/null +++ b/src/views/pages/vote/components/EditDialog.vue @@ -0,0 +1,251 @@ + + + + + diff --git a/src/views/pages/vote/index.vue b/src/views/pages/vote/index.vue new file mode 100644 index 0000000..e0cbd6d --- /dev/null +++ b/src/views/pages/vote/index.vue @@ -0,0 +1,288 @@ + + + + + diff --git a/src/views/pages/workOrder/orderList/index.vue b/src/views/pages/workOrder/orderList/index.vue index a3a8e4e..770806b 100644 --- a/src/views/pages/workOrder/orderList/index.vue +++ b/src/views/pages/workOrder/orderList/index.vue @@ -96,7 +96,8 @@ defineOptions({ const { t } = useI18n() // 解构出t方法 const columns = [ // { title: '用户名称', dataIndex: 'customerName', width: 100 }, - { title: '工单分类', dataIndex: 'label', width: 100 }, + { title: '工单分类', dataIndex: 'orderType', width: 100 }, + { title: '工单区域', dataIndex: 'orderAreaName', width: 150 }, // { title: '工单标题', dataIndex: 'content', ellipsis: true }, { title: '工单内容', dataIndex: 'title', ellipsis: true, width: 200 }, { title: '图片/视频', dataIndex: 'url', width: 100, align: 'center' }, @@ -218,10 +219,9 @@ function handleDelete(value) { try { const params = { ...value, - status: 98 } console.log(params) - const { success } = await apis.orderList.updateMenu(value.id, params).catch(() => { + const { success } = await apis.orderList.delMenu(value.id, params).catch(() => { throw new Error() }) if (config('http.code.success') === success) {