任务提交

This commit is contained in:
zwq 2025-06-22 18:36:25 +08:00
parent b004356582
commit 6c73c78473
5 changed files with 255 additions and 151 deletions

View File

@ -1,7 +1,7 @@
// 参数接口 // 参数接口
// 响应接口 // 响应接口
import { get, post } from "@/utils/request"; import {get, post} from "@/utils/request";
/** /**
* *
@ -30,6 +30,18 @@ export const jsConfirmJsDataApi = async (params: any) => {
export const jsdFindPageTaskApi = async (params: any) => { export const jsdFindPageTaskApi = async (params: any) => {
return await get("/api/jsd/findPageTask", params); return await get("/api/jsd/findPageTask", params);
}; };
export const rwflFindRwlxsByRwId = async (params: any) => {
return await get("/api/rwlx/findRwlxsByRwId", params);
}
export const rwzxSaveApi = async (params: any) => {
return await post("/api/rwzx/save", params);
};
export const rwFindInfoByRwId = async (params: any) => {
return await get("/api/rw/findInfoByRwId", params);
}
export const fractionRuleApi = async () => { export const fractionRuleApi = async () => {
return await get( return await get(
"/api/fractionRule/findAllByItemId?itemId=CDFDED2A704F46E2A4D7E8816968BD23" "/api/fractionRule/findAllByItemId?itemId=CDFDED2A704F46E2A4D7E8816968BD23"

View File

@ -87,6 +87,7 @@ export function useForm(options: FormOptions): UseForm {
function algorithm(schemaItem: FormsSchema) { function algorithm(schemaItem: FormsSchema) {
let upSchemaList: FormsSchema = options.schema.filter(item => item.field === schemaItem.field)[0] let upSchemaList: FormsSchema = options.schema.filter(item => item.field === schemaItem.field)[0]
for (const key in schemaItem) { for (const key in schemaItem) {
//console.log(11,key,schemaItem[key],typeof schemaItem[key])
// @ts-ignore // @ts-ignore
if (typeof schemaItem[key] === 'object') { if (typeof schemaItem[key] === 'object') {
// @ts-ignore // @ts-ignore

View File

@ -2,32 +2,37 @@
<template> <template>
<view class="message-detail-page"> <view class="message-detail-page">
<view v-if="isLoading" class="loading-indicator">加载中...</view> <view v-if="isLoading" class="loading-indicator">加载中...</view>
<view v-else-if="messageDetail" class="detail-content"> <view v-else class="detail-content">
<view class="detail-header"> <view class="detail-header">
<view class="title-tag-row"> <view class="title-tag-row">
<text class="detail-title">{{ messageDetail.title }}</text> <text class="detail-title">{{ rw.rwmc }}</text>
<view class="tag" :class="messageDetail.tagType">{{ messageDetail.tagText }}</view> <view class="tag" :class="messageDetail.tagType">{{ messageDetail.tagText }}</view>
</view> </view>
<view class="detail-meta"> <view class="detail-meta">
<text>{{ messageDetail.date }}</text> <text>{{ rw.rwkstime }}</text>
<text>{{ messageDetail.timeAgo }}</text> <!-- <text>{{ messageDetail.timeAgo }}</text>-->
</view> </view>
</view> </view>
<view class="detail-body"> <view class="detail-body">
<text class="detail-desc">{{ messageDetail.desc }}</text> <BasicForm :schema="schema" v-model="formData">
<!-- Add more detailed content here as needed -->
</BasicForm>
</view> </view>
<view class="detail-footer"> <view class="detail-footer">
<button type="primary" class="action-button">处理</button> <button type="primary" class="action-button" @click="saveRwZx">处理</button>
</view> </view>
</view> </view>
<view v-else class="empty-state">消息详情未找到</view> <!-- <view v-else class="empty-state">消息详情未找到</view>-->
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import {ref} from 'vue';
import { onLoad } from '@dcloudio/uni-app'; import {onLoad} from '@dcloudio/uni-app';
import {rwFindInfoByRwId, rwflFindRwlxsByRwId, rwzxSaveApi} from "@/api/base/server";
import {useForm} from "@/components/BasicForm/hooks/useForm";
import {navigateBack, showToast} from "@/utils/uniapp";
import {useUserStore} from "@/store/modules/user";
interface MessageDetail { interface MessageDetail {
id: string; // Assuming an ID is passed or can be derived id: string; // Assuming an ID is passed or can be derived
@ -40,54 +45,106 @@ interface MessageDetail {
// Add other fields as necessary // Add other fields as necessary
} }
const formData = ref({})
const messageId = ref<string>(''); const messageId = ref<string>('');
const messageDetail = ref<MessageDetail | null>(null); const messageDetail = ref<MessageDetail | null>({
const isLoading = ref(false); id: 'todo1',
title: '教务通知 (待办)',
onLoad((options) => { desc: '学校召开期初教学准备会议暨首次教学工作例会. 会议强调了新学期的教学重点和要求,请各位老师认真准备。',
// Assume the identifier is passed as 'id' query parameter date: '2025-02-17',
// If you pass the whole object, you can parse it here timeAgo: '8 mins 前',
if (options && options.id) { tagText: '通知',
messageId.value = decodeURIComponent(options.id); // Decode if necessary tagType: 'notice',
fetchMessageDetail(); likes: 6,
} else { comments: 12
console.error('Message ID/Data is missing!');
uni.showToast({ title: '加载失败,缺少信息', icon: 'none' });
}
}); });
const isLoading = ref(false);
const rwflx: any = ref([])
const rw = ref({})
const schema = reactive<FormsSchema[]>([])
const {getUser} = useUserStore()
// async function saveRwZx() {
const fetchMessageDetail = async () => { console.log(222, formData.value)
console.log(`Fetching details for message ID: ${messageId.value}`); const result = [];
isLoading.value = true; for (let i = 0; i < rwflx.value.length; i++) {
await new Promise(resolve => setTimeout(resolve, 300)); console.log(44, rwflx.value[i].id, formData.value[rwflx.value[i].id])
if (rwflx.value[i].rwbs && (!formData.value[rwflx.value[i].id] || formData.value[rwflx.value[i].id] == "")) {
showToast("请填写必填项!")
return;
}
result.push({
rwlxId: rwflx.value[i].id,
rwzxqdtx: formData.value[rwflx.value[i].id],
})
}
await rwzxSaveApi({
mobile: getUser.mobile,
rwId: rw.value.id,
rwzxqdDtos: result
})
showToast("操作成功!");
navigateBack()
}
// --- Replace with actual API call using messageId.value --- onLoad(async (options) => {
if (options && options.id) {
// Find the mock data based on the passed identifier (using title as ID for now) const {result} = await rwFindInfoByRwId({
const mockTodoList = [ rwId: options.id
{ id: 'todo1', title: '教务通知 (待办)', desc: '学校召开期初教学准备会议暨首次教学工作例会. 会议强调了新学期的教学重点和要求,请各位老师认真准备。', date: '2025-02-17', timeAgo: '8 mins 前', tagText: '通知', tagType: 'notice', likes: 6, comments: 12 }, });
{ id: 'todo2', title: '教学日志 (待办)', desc: '请于2025年3月15日前上传教学日志确保内容详实、准确。日志系统入口已在办公平台开放。', date: '2025-02-17', timeAgo: '8 mins 前', tagText: '任务', tagType: 'task', likes: 6, comments: 12 }, rwflx.value = result.rwlxes;
// Add mock data for '' if needed, or handle different types rw.value = result;
{ id: 'done1', title: '审批完成 (已办)', desc: '您的请假申请已审批通过。', date: '2025-02-16', timeAgo: '1 天前', tagText: '审批', tagType: 'approval', likes: 0, comments: 0 }, for (let i = 0; i < rwflx.value.length; i++) {
]; if (rwflx.value[i].rwfl == "sctp" || rwflx.value[i].rwfl == "scsp" || rwflx.value[i].rwfl == "scwd") {
schema.push({
// Find based on ID (or title if ID is not directly available) field: `${rwflx.value[i].id}`,
messageDetail.value = mockTodoList.find(item => item.id === messageId.value || item.title === messageId.value) || null; label: `${rwflx.value[i].rwbt}`,
component: "BasicUpload",
isLoading.value = false; required: rwflx.value[i].rwbs,
componentProps: {}
if (!messageDetail.value) { })
console.error(`Details not found for message ID: ${messageId.value}`); } else if (rwflx.value[i].rwfl == "text") {
uni.showToast({ title: '未找到消息详情', icon: 'none' }); schema.push({
} else { field: `${rwflx.value[i].id}`,
// Set navigation bar title dynamically label: `${rwflx.value[i].rwbt}`,
uni.setNavigationBarTitle({ component: "BasicInput",
title: messageDetail.value.tagText || '消息详情' required: rwflx.value[i].rwbs,
itemProps: {
labelPosition: "top",
},
componentProps: {
type: "textarea",
},
})
} else if (rwflx.value[i].rwfl == "dxsx" || rwflx.value[i].rwfl == "dxxz") {
let options = rwflx.value[i].remark.split("");
let range = [];
for (let i = 0; i < options.length; i++) {
range.push({
name: options[i]
}); });
} }
}; schema.push({
field: `${rwflx.value[i].id}`,
label: `${rwflx.value[i].rwbt}`,
component: "BasicPicker",
required: rwflx.value[i].rwbs,
itemProps: {
labelPosition: "top",
},
componentProps: {
range: range,
rangeKey: "name",
savaKey: "name",
},
})
}
}
} else {
console.error('Message ID/Data is missing!');
uni.showToast({title: '加载失败,缺少信息', icon: 'none'});
}
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -143,16 +200,28 @@ const fetchMessageDetail = async () => {
white-space: nowrap; white-space: nowrap;
flex-shrink: 0; // Prevent tag from shrinking flex-shrink: 0; // Prevent tag from shrinking
&.notice { background-color: #447ade; } &.notice {
&.task { background-color: #19be6b; } background-color: #447ade;
&.approval { background-color: #ff9f0a; } }
&.submit { background-color: #8e8e93; }
&.task {
background-color: #19be6b;
}
&.approval {
background-color: #ff9f0a;
}
&.submit {
background-color: #8e8e93;
}
} }
.detail-meta { .detail-meta {
font-size: 12px; font-size: 12px;
color: #999; color: #999;
text { text {
margin-right: 15px; margin-right: 15px;
} }
@ -161,6 +230,7 @@ const fetchMessageDetail = async () => {
.detail-body { .detail-body {
margin-bottom: 40px; margin-bottom: 40px;
.detail-desc { .detail-desc {
font-size: 15px; font-size: 15px;
color: #555; color: #555;

View File

@ -113,12 +113,21 @@ onMounted(() => {
}); });
const goToDetail = (data: any) => { const goToDetail = (data: any) => {
if (currentTab.value != 1) {
return;
}
// if(true){
// const encodedTitle = encodeURIComponent(" ()");
// uni.navigateTo({
// url: `/pages/base/message/detail?id=${encodedTitle}`
// });
// return;
// }
// Ensure data and data.id exist before navigating // Ensure data and data.id exist before navigating
if (data && data.id) { if (data && data.id) {
// Encode the ID in case it contains special characters // Encode the ID in case it contains special characters
const encodedId = encodeURIComponent(data.id);
uni.navigateTo({ uni.navigateTo({
url: `/pages/base/message/detail?id=${encodedId}` url: `/pages/base/message/detail?id=${data.id}`
}); });
} else if (data && data.rwmc) { } else if (data && data.rwmc) {
// Fallback: use title if id is missing (less reliable) // Fallback: use title if id is missing (less reliable)

View File

@ -40,7 +40,10 @@
<!-- 输入框 --> <!-- 输入框 -->
<view class="input-group"> <view class="input-group">
<view class="input-item"> <view class="input-item">
<text class="label"><text class="required">*</text>姓名:</text> <text class="label">
<text class="required">*</text>
姓名:
</text>
<input <input
class="input-field" class="input-field"
type="text" type="text"
@ -49,7 +52,10 @@
/> />
</view> </view>
<view class="input-item"> <view class="input-item">
<text class="label"><text class="required">*</text>手机号码:</text> <text class="label">
<text class="required">*</text>
手机号码:
</text>
<input <input
class="input-field" class="input-field"
type="number" type="number"
@ -59,7 +65,10 @@
/> />
</view> </view>
<view class="input-item verification-code-item"> <view class="input-item verification-code-item">
<text class="label"><text class="required">*</text>验证码:</text> <text class="label">
<text class="required">*</text>
验证码:
</text>
<input <input
class="input-field verification-code-input" class="input-field verification-code-input"
type="number" type="number"
@ -84,19 +93,20 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, computed } from "vue"; import {ref, reactive, computed} from "vue";
import CustomUpload from "/src/components/BasicUpload/CustomUpload.vue"; import CustomUpload from "/src/components/BasicUpload/CustomUpload.vue";
import { onUnmounted } from "vue"; import {onUnmounted} from "vue";
import { hideLoading, isTabBar, showLoading } from "@/utils/uniapp"; import {hideLoading, isTabBar, showLoading} from "@/utils/uniapp";
import { attachmentUpload } from "@/api/system/upload"; import {attachmentUpload} from "@/api/system/upload";
import { useDataStore } from "@/store/modules/data"; import {useDataStore} from "@/store/modules/data";
import { import {
findJsByPhoneApi, findJsByPhoneApi,
sendCodeApi, sendCodeApi,
updateUserApi, updateUserApi,
} from "@/api/system/login"; } from "@/api/system/login";
import { useUserStore } from "@/store/modules/user"; import {useUserStore} from "@/store/modules/user";
const { getGlobal } = useDataStore();
const {getGlobal} = useDataStore();
const formData = reactive({ const formData = reactive({
loginName: "", loginName: "",
phone: "", phone: "",
@ -118,7 +128,7 @@ const handleGetCode = async () => {
return; return;
} }
if (!formData.phone) { if (!formData.phone) {
uni.showToast({ title: "请输入手机号码", icon: "none" }); uni.showToast({title: "请输入手机号码", icon: "none"});
return; return;
} }
@ -127,9 +137,9 @@ const handleGetCode = async () => {
phone: formData.phone, phone: formData.phone,
}); });
if (result.resultCode == 1) { if (result.resultCode == 1) {
uni.showToast({ title: "验证码发送成功", icon: "success" }); uni.showToast({title: "验证码发送成功", icon: "success"});
} else { } else {
uni.showToast({ title: "验证码发送失败", icon: "none" }); uni.showToast({title: "验证码发送失败", icon: "none"});
} }
isCountingDown.value = true; isCountingDown.value = true;
countdown.value = 60; // countdown.value = 60; //
@ -156,17 +166,17 @@ function toHome(data: any) {
} }
} }
const { afterLoginAction } = useUserStore(); const {afterLoginAction} = useUserStore();
const { setFile } = useDataStore(); const {setFile} = useDataStore();
const handleVerify = async () => { const handleVerify = async () => {
if ( if (
!formData.loginName || !formData.loginName ||
!formData.phone || !formData.phone ||
!formData.code || !formData.code
!formData.avatarUrl // || !formData.avatarUrl
) { ) {
uni.showToast({ title: "请填写完整的验证信息", icon: "none" }); uni.showToast({title: "请填写完整的验证信息", icon: "none"});
return; return;
} }
const result = await updateUserApi({ const result = await updateUserApi({
@ -180,7 +190,7 @@ const handleVerify = async () => {
if (result.resultCode == 1) { if (result.resultCode == 1) {
if (result.result) { if (result.result) {
afterLoginAction(result.result); afterLoginAction(result.result);
uni.showToast({ title: "验证成功", icon: "success" }); uni.showToast({title: "验证成功", icon: "success"});
if (getGlobal.type == 1) { if (getGlobal.type == 1) {
toHome(getGlobal); toHome(getGlobal);
} else { } else {
@ -205,16 +215,16 @@ const handleVerify = async () => {
} }
} }
} else { } else {
uni.showToast({ title: result.message || "验证失败", icon: "none" }); uni.showToast({title: result.message || "验证失败", icon: "none"});
} }
} else { } else {
uni.showToast({ title: result.message || "验证失败", icon: "none" }); uni.showToast({title: result.message || "验证失败", icon: "none"});
} }
}; };
async function afterRead(event: any) { async function afterRead(event: any) {
showLoading({ title: "上传中" }); showLoading({title: "上传中"});
const { result } = await attachmentUpload(event.tempFilePaths[0]); const {result} = await attachmentUpload(event.tempFilePaths[0]);
hideLoading(); hideLoading();
formData.avatarUrl = result[0].filePath; formData.avatarUrl = result[0].filePath;
} }
@ -346,6 +356,7 @@ onUnmounted(() => {
color: #cccccc; color: #cccccc;
border-color: #cccccc; border-color: #cccccc;
} }
// //
.get-code-btn::after { .get-code-btn::after {
border: none; border: none;
@ -363,6 +374,7 @@ onUnmounted(() => {
border: none; // border: none; //
box-shadow: 0 2px 5px rgba(255, 100, 100, 0.3); // box-shadow: 0 2px 5px rgba(255, 100, 100, 0.3); //
} }
// //
.verify-btn::after { .verify-btn::after {
border: none; border: none;