| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665 |
- <template>
- <view class="page_body">
- <!-- 头部 -->
- <nav-bar height="96" title="提交材料" :onlyTitle="true" :showHeaderborder="true" @GoBack="GoBack"></nav-bar>
- <view class="page_content_height">
- <view class="page_content padding_btm">
- <view class="task_title">{{state?.details?.taskName}}</view>
- <view class="task_class_collect">
- <text class="class_item">{{state?.details?.departmentName}}</text>
- <text class="class_item">{{state?.details?.materialCategoryName}}</text>
- <text class="class_item">{{state?.details?.createdBy}}</text>
- </view>
- <view class="task_time">
- <view class="time_day">
- <text class="time_item">{{state?.details?.startTime}}</text>
- <text class="time_item">至</text>
- <text class="time_item">{{state?.details?.endTime}}</text>
- <text class="time_item" v-if="state?.details?.taskStatus === 1 && remainingDays(state?.details?.endTime) > 0">剩余{{remainingDays(state?.details?.endTime)}}天</text>
- </view>
- <view :class="['task_status', statusClassMap[state?.details?.taskStatus]]">
- {{taskStatusMap[state?.details?.taskStatus]}}
- </view>
- </view>
- <view :class="['task_desc',{'over':!state.isExpand}]">
- 采集要求:{{state?.details?.collectionRequire}}
- </view>
- <view class="task_desc_all">
- 采集要求:{{state?.details?.collectionRequire}}
- </view>
- <view class="expand_btn" v-if="state.showExpandBtn" @click="toggleExpand"><text
- class="expand_text">{{!state.isExpand?'展开':'收起'}}</text><uni-icons class="expand_icon"
- :type="!state.isExpand?'down':'up'"></uni-icons></view>
- </view>
- <!-- 间隔 -->
- <view class="row_gap"></view>
- <view class="page_content">
- <view class="target_status">
- <view class="target_tag">
- <template v-for="text in ['departmentName','departmentGroupName','subjectName','gradeName','classTypeName','className']">
- <text class="info_text" v-if="state?.targetFileList?.[text]" :key="text">{{state?.targetFileList?.[text]}}</text>
- </template>
- </view>
- <template v-if="state?.details?.auditMechanism === 1">
- <view v-if="state?.targetFileList?.targetStatus=== 1" class="status_tag notSubmitList">
- <text>待提交</text>
- </view>
- <view v-if="state?.targetFileList?.targetStatus=== 3" class="status_tag reviewReasonList">
- <text>已驳回</text>
- </view>
- <view v-if="state?.targetFileList?.targetStatus=== 2" class="status_tag notReviewList">
- <text>审核中</text>
- </view>
- <view v-if="state?.targetFileList?.targetStatus=== 4" class="status_tag reviewList">
- <text>已提交</text>
- </view>
- </template>
- <template v-if="state?.details?.auditMechanism === 0">
- <view v-if="state?.targetFileList?.targetStatus=== 1" class="status_tag notSubmitList">
- <text>待提交</text>
- </view>
- <view v-else class="status_tag reviewList">
- <text>已提交</text>
- </view>
- </template>
-
- </view>
- <!-- 上传按钮 提交状态 1待提交 2审核中 3已驳回 4已提交 -->
- <view class="upload_box">
- <template v-if="state?.targetFileList?.targetStatus === 1 && state?.details?.taskStatus !== 2">
- <image class="upload_icon" src="@/static/image/icon/upload_icon.png"></image>
- <view class="upload_text">
- <view class="upload_title">点击上传文件</view>
- <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
- </view>
- </template>
- <template v-if="(state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4) && state?.details?.taskStatus !== 2">
- <image class="upload_icon" src="@/static/image/icon/upload_locked.png"></image>
- <view class="upload_text">
- <view class="upload_title">点击重新编辑可再提交</view>
- <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
- </view>
- </template>
- <template v-if="state?.targetFileList?.targetStatus === 3 && state?.details?.taskStatus !== 2">
- <image class="upload_icon" src="@/static/image/icon/upload_locked.png"></image>
- <view class="upload_text">
- <view class="upload_title">请先删除全部文件,再提交调整后的合规材料</view>
- <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
- </view>
- </template>
- <template v-if="state?.details?.taskStatus == 2">
- <image class="upload_icon" src="@/static/image/icon/upload_locked.png"></image>
- <view class="upload_text">
- <view class="upload_title">已结束不可再提交</view>
- <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
- </view>
- </template>
- </view>
- <view class="list_item" v-for="item in (state?.targetFileList?.taskTargetFileVos || [])" :Key="item.id">
- <image class="file_icon" src="@/static/image/icon/file.png"></image>
- <view class="file_info">
- <view class="file_name">{{item.fileName}}</view>
- <view class="file_size">
- <text>{{getFileSize(item.fileSize)}}</text>
- <text>{{ item.createTime }}</text>
- </view>
- </view>
- <view class="file_btn">
- <text @click="HandleDeleteFileList(item)" :class="['del',{'disabled':state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4}]">删除</text>
- <text class="download">下载</text>
- </view>
- </view>
- </view>
- </view>
- <view class="page_foot" v-if="state?.details?.taskStatus!=2">
- <!-- 提交状态 1待提交 2审核中 3已驳回 4已提交 -->
- <template v-if="(state?.targetFileList?.targetStatus === 1 || state?.targetFileList?.targetStatus === 3)">
- <view @click="DeleteAllFiles" :class="['del',{'disabled':!state?.targetFileList?.taskTargetFileVos?.length}]">删除全部</view>
- <view class="submit" @click="UpdateTaskTarget">提交</view>
- </template>
- <template v-else>
- <view class="del disabled">删除全部</view>
- <view class="submit" @click="UpdateTaskTargetReset">重新编辑</view>
- </template>
- </view>
- <!-- 删除确认框 -->
- <popupDialog ref="popupDelDialogRef" :showFootBorder="true" :content="state.delDialog.content" @DialogConfirm="DialogDelConfirm" />
- </view>
- </template>
- <script setup>
- import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
- import popupDialog from '@/components/popupDialog.vue';
- import navBar from '@/components/navBar.vue';
- import { remainingDays,getFileSize } from '@/common/common.js';
- import {getTaskTargetFileList,DeleteFileList,DelTaskTargetFileList,updateTaskTarget} from '@/reqApi/notification.js';
- import {onLoad} from '@dcloudio/uni-app';
- import {
- reactive,
- ref,
- nextTick,
- getCurrentInstance,
- onMounted
- } from 'vue';
- const state = reactive({
- taskId: '', //任务id
- targetId:'',//
- showExpandBtn: false, //是否显示展开按钮
- isExpand: false, //是否展开
- details: {}, //详情信息
- targetFileList:{},
- delDialog:{
- type:'',
- content:'',
- fileUrls:[],
- targetFileIds:[]
- },
- });
- const popupDelDialogRef = ref(null);
- const statusClassMap = {
- 1: 'status_published',
- 2: 'status_closed'
- };
- const taskStatusMap = {
- 1: '进行中',
- 2: '已结束'
- };
- onLoad((option) => {
- state.taskId = option.taskId;
- state.targetId = option.targetId;
- })
- onMounted(() => {
- state.details = uni.getStorageSync('submitMaterialDetailInfo') || {};
- checkTextOverflow();
- GetTaskTargetFileList();
- });
- const checkTextOverflow = () => {
- nextTick(() => {
- const instance = getCurrentInstance();
- // 安全保护
- if (!instance || !instance.proxy) {
- // 备用方案:全局查询(要求元素 class 唯一)
- let taskDescAllHeight = 0,
- taskDescHeight = 0;
- const query = uni.createSelectorQuery();
- query.select('.task_desc_all').boundingClientRect((rect) => {
- taskDescAllHeight = rect?.height || 0;
- });
- query.select('.task_desc').boundingClientRect((rect) => {
- taskDescHeight = rect?.height || 0;
- });
- query.select('.page_content_data').boundingClientRect((rect) => {
- state.searchBoxTop = rect?.top || 0;
- });
- query.exec(() => {
- // 所有回调执行完毕后触发
- state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
- });
- return;
- }
- let taskDescAllHeight = 0,
- taskDescHeight = 0;
- const query = uni.createSelectorQuery().in(instance.proxy);
- query.select('.task_desc_all').boundingClientRect((rect) => {
- taskDescAllHeight = rect?.height || 0;
- });
- query.select('.task_desc').boundingClientRect((rect) => {
- taskDescHeight = rect?.height || 0;
- });
- query.select('.page_content_data').boundingClientRect((rect) => {
- state.searchBoxTop = rect?.top || 0;
- });
- query.exec(() => {
- // 所有回调执行完毕后触发
- state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
- });
- });
- }
- // 展开收起切换
- const toggleExpand = () => {
- state.isExpand = !state.isExpand;
- }
- //获取当前教师提交的文件列表
- const GetTaskTargetFileList = () => {
- getTaskTargetFileList(state.targetId).then(res=>{
- if(res.code == 200){
- state.targetFileList = res.data || {};
- }
- })
- }
- //单个删除
- const HandleDeleteFileList = (item) => {
- if(state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4){
- return false
- }
- const { filePath, id } = item;
- state.delDialog = {
- type:'del',
- content:'是否删除当前文件?',
- fileUrls:[filePath],
- targetFileIds:[id]
- };
- popupDelDialogRef.value.OpenDialog();
- }
- //删除全部
- const DeleteAllFiles = () => {
- let fileUrls = [],targetFileIds = [];
- const taskTargetFileVos = state?.targetFileList?.taskTargetFileVos || [];
- if(taskTargetFileVos.length > 0){
- taskTargetFileVos.forEach(item => {
- fileUrls.push(item.filePath);
- targetFileIds.push(item.id)
- })
- state.delDialog = {
- type:'del',
- content:'是否删除全部当前文件?',
- fileUrls:fileUrls,
- targetFileIds:targetFileIds
- };
- popupDelDialogRef.value.OpenDialog();
- }
- }
- //提交
- const UpdateTaskTarget = () => {
- const taskTargetFileVos = state?.targetFileList?.taskTargetFileVos || [];
- if(taskTargetFileVos.length == 0){
- uni.showToast({
- title: '请上传提交文件!',
- icon: 'none'
- });
- return false
- }
- state.delDialog = {
- type:'submit',
- content:'是否提交当前任务?',
- fileUrls:[],
- targetFileIds:[]
- };
- popupDelDialogRef.value.OpenDialog();
- }
- //重新提交
- const UpdateTaskTargetReset = () => {
- state.delDialog = {
- type:'submit',
- content:'是否重新编辑当前任务?',
- fileUrls:[],
- targetFileIds:[]
- };
- popupDelDialogRef.value.OpenDialog();
- }
- //确定删除 确定提交
- const DialogDelConfirm = () => {
- if(state.delDialog.type == 'del'){//单个删除 批量删除
- DelFileList();
- }else if(state.delDialog.type == 'submit') {//提交
- submitTaskTarget();
- }
- }
- const DelFileList = async() => {
- const res = await DeleteFileList({ fileUrls: state.delDialog.fileUrls })
- if (res.code !== 200) {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- return false
- }
- const resData = await DelTaskTargetFileList({
- targetId: state.targetId,
- targetFileIds: state.delDialog.targetFileIds
- })
- if (resData.code === 200) {
- uni.showToast({
- title: '删除成功!',
- icon: 'none'
- });
- GetTaskTargetFileList();
- }
- }
- //提交
- const submitTaskTarget = () => {
- updateTaskTarget(state.targetId).then(res => {
- if (res.code === 200) {
- uni.showToast({
- title: '提交成功!',
- icon: 'none'
- });
- GetTaskTargetFileList();
- }
- })
- }
- //返回
- const GoBack = () => {
- uni.navigateBack({
- delta: 1
- });
- }
- </script>
- <style scoped lang="scss">
- .page_content_height{
- display: flex;
- flex-direction: column;
- width: 100%;
- height: calc(100% - 226rpx);
- }
- .page_content {
- &.padding_btm {
- padding-bottom: 24rpx;
- .task_title {
- font-weight: 500;
- font-size: 32rpx;
- color: #333333;
- margin-top: 24rpx;
- }
- .task_class_collect {
- display: inline-flex;
- align-items: center;
- flex-wrap: wrap;
- width: 100%;
- margin-top: 16rpx;
- gap: 16rpx;
- .class_item {
- font-weight: 400;
- font-size: 24rpx;
- color: #999999;
- }
- }
- .task_time {
- display: flex;
- align-items: flex-start;
- width: 100%;
- margin-top: 16rpx;
- .time_day {
- display: inline-flex;
- align-items: center;
- flex-wrap: wrap;
- flex: 1;
- .time_item {
- font-weight: 400;
- font-size: 24rpx;
- line-height: 48rpx;
- color: #999999;
- &:nth-child(2) {
- margin: 0 8rpx;
- }
- &:nth-child(4) {
- color: #2E64FA;
- margin-left: 16rpx;
- }
- }
- }
- .task_status {
- display: inline-flex;
- align-items: center;
- height: 48rpx;
- padding: 0 12rpx;
- border-radius: 8rpx;
- font-weight: 400;
- font-size: 24rpx;
- &.status_pending {
- background: rgba(46, 100, 250, 0.1);
- color: #2E64FA;
- }
-
- &.status_published {
- background: rgba(82, 196, 26, 0.1);
- color: #2BC644;
- }
-
- &.status_closed {
- background: #6666661a;
- color: #666666;
- }
- }
- }
- .task_desc {
- margin-top: 24rpx;
- display: flex;
- width: 100%;
- padding-top: 24rpx;
- border-top: 2rpx solid #F3F3F3;
- font-weight: 400;
- font-size: 28rpx;
- color: #999999;
- line-height: 44rpx;
- box-sizing: border-box;
- position: relative;
- &.over {
- max-height: 168rpx;
- overflow: hidden;
- transition: all 0.25s;
- display: -webkit-box;
- -webkit-line-clamp: 3;
- -webkit-box-orient: vertical;
- }
- }
- .task_desc_all {
- display: flex;
- width: 100%;
- padding-top: 24rpx;
- border-top: 2rpx solid #F3F3F3;
- font-weight: 400;
- font-size: 28rpx;
- color: #999999;
- line-height: 44rpx;
- box-sizing: border-box;
- position: absolute;
- left: -9999px;
- top: 0;
- visibility: hidden; // 不可见但占据空间(不影响布局,因为absolute)
- pointer-events: none;
- }
- .expand_btn {
- width: 100%;
- height: 40rpx;
- background-color: #FFFFFF;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- .expand_text {
- font-weight: 400;
- font-size: 28rpx;
- color: #2E64FA;
- margin-right: 8rpx;
- }
- .expand_icon {
- font-size: 32rpx !important;
- color: #2E64FA !important;
- }
- }
- }
- }
- .row_gap {
- background-color: #F8F9FD;
- width: 100%;
- height: 24rpx;
- }
- .target_status {
- width: 100%;
- display: flex;
- align-items: center;
- padding: 24rpx 0;
- border-bottom: 2rpx solid #F3F3F3;
- .target_tag{
- flex: 1;
- font-weight: 500;
- font-size: 32rpx;
- color: #333333;
- .info_text{
- flex-shrink: 0;
- margin-right: 12rpx;
- }
- }
- .status_tag{
- font-size: 24rpx;
- text-align: center;
- padding: 8rpx 12rpx;
- font-weight: 400;
- border-radius: 8rpx;
- flex-shrink: 0;
- &.notSubmitList {
- background: rgba(46,100,250,0.1);
- color: #2E64FA;
- }
- &.notReviewList {
- background: rgba(251,159,52,0.1);
- color: #FB9F34;
- }
- &.reviewReasonList {
- background: rgba(245,108,108,0.1);
- color: #F56C6C;
- }
- &.reviewList {
- background: rgba(43,198,68,0.1);
- color: #2BC644;
- }
- }
- }
- .upload_box{
- margin-top: 24rpx;
- width: 100%;
- background-color: #FAFBFF;
- border-radius: 20rpx;
- border: 2rpx dashed #CCCED4;
- display: flex;
- box-sizing: border-box;
- align-items: center;
- padding: 22rpx 0 22rpx 40rpx;
- .upload_icon{
- width: 64rpx;
- height: 64rpx;
- margin-right: 24rpx;
- flex-shrink: 0;
- }
- .upload_text{
- flex:1;
- display: flex;
- flex-direction: column;
- .upload_title{
- font-weight: 400;
- font-size: 28rpx;
- color: #666666;
- }
- .upload_desc{
- margin-top: 8rpx;
- font-weight: 400;
- font-size: 20rpx;
- color: #CCCED4;
- }
- }
- }
- .list_item {
- display: flex;
- align-items: center;
- width: 100%;
- padding: 20rpx 24rpx;
- background: #FFFFFF;
- border-radius: 20rpx;
- border: 2rpx solid #EBEEF5;
- box-sizing: border-box;
- margin-top: 24rpx;
- gap:20rpx;
- .file_icon{
- flex-shrink: 0;
- width: 80rpx;
- height: 80rpx;
- }
- .file_info{
- flex:1;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- .file_name{
- width: 100%;
- font-weight: 500;
- font-size: 28rpx;
- color: #333333;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .file_size{
- display: flex;
- width: 100%;
- gap: 20rpx;
- font-weight: 400;
- font-size: 24rpx;
- color: #999999;
- margin-top: 8rpx;
- }
- }
- .file_btn{
- flex-shrink: 0;
- display: flex;
- gap:24rpx;
- font-weight: 400;
- font-size: 28rpx;
- .del{
- color: #F56C6C;
- &.disabled{
- color: #C0C4CC;
- }
- }
- .download{
- color: #2E64FA;
- }
- }
- }
- .page_foot{
- position: fixed;
- display: flex;
- left: 0;
- right: 0;
- bottom: 0;
- padding: 20rpx 24rpx;
- background-color: #FFFFFF;
- gap: 32rpx;
- .del{
- display: flex;
- align-items: center;
- justify-content: center;
- width: 240rpx;
- height: 90rpx;
- box-sizing: border-box;
- border-radius: 8rpx;
- border: 2rpx solid #F56C6C;
- font-weight: 400;
- font-size: 28rpx;
- color: #F56C6C;
- &.disabled{
- color: #C0C4CC;
- border: 2rpx solid #C0C4CC;
- }
- }
- .submit {
- flex:1;
- height: 90rpx;
- background-color: #2E64FA;
- border-radius: 8rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- font-weight: 500;
- font-size: 28rpx;
- color: #FFFFFF;
- }
- }
- </style>
|