Browse Source

作品评分详情

lvmax 8 months ago
parent
commit
df556d2a19
3 changed files with 357 additions and 19 deletions
  1. 199 0
      src/api/work/index.vue
  2. 9 0
      src/api/work/score/index.ts
  3. 149 19
      src/views/work/score/index.vue

+ 199 - 0
src/api/work/index.vue

@@ -0,0 +1,199 @@
+<template>
+  <ContentWrap>
+    <!-- 搜索工作栏 -->
+    <el-form
+      class="-mb-15px"
+      :model="queryParams"
+      ref="queryFormRef"
+      :inline="true"
+      label-width="68px"
+    >
+      <el-form-item label="作品id" prop="workId">
+        <el-input
+          v-model="queryParams.workId"
+          placeholder="请输入作品id"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item label="评分" prop="score">
+        <el-input
+          v-model="queryParams.score"
+          placeholder="请输入评分"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item label="创建时间" prop="createTime">
+        <el-date-picker
+          v-model="queryParams.createTime"
+          value-format="YYYY-MM-DD HH:mm:ss"
+          type="daterange"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+          class="!w-220px"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
+        <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
+        <el-button
+          type="primary"
+          plain
+          @click="openForm('create')"
+          v-hasPermi="['work:score:create']"
+        >
+          <Icon icon="ep:plus" class="mr-5px" /> 新增
+        </el-button>
+        <el-button
+          type="success"
+          plain
+          @click="handleExport"
+          :loading="exportLoading"
+          v-hasPermi="['work:score:export']"
+        >
+          <Icon icon="ep:download" class="mr-5px" /> 导出
+        </el-button>
+      </el-form-item>
+    </el-form>
+  </ContentWrap>
+
+  <!-- 列表 -->
+  <ContentWrap>
+    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
+      <el-table-column label="id" align="center" prop="id" />
+      <el-table-column label="作品id" align="center" prop="workId" />
+      <el-table-column label="评分状态(0未提交)(1已提交)" align="center" prop="status" />
+      <el-table-column label="评分" align="center" prop="score" />
+      <el-table-column
+        label="创建时间"
+        align="center"
+        prop="createTime"
+        :formatter="dateFormatter"
+        width="180px"
+      />
+      <el-table-column label="操作" align="center" min-width="120px">
+        <template #default="scope">
+          <el-button
+            link
+            type="primary"
+            @click="openForm('update', scope.row.id)"
+            v-hasPermi="['work:score:update']"
+          >
+            编辑
+          </el-button>
+          <el-button
+            link
+            type="danger"
+            @click="handleDelete(scope.row.id)"
+            v-hasPermi="['work:score:delete']"
+          >
+            删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 分页 -->
+    <Pagination
+      :total="total"
+      v-model:page="queryParams.pageNo"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </ContentWrap>
+
+  <!-- 表单弹窗:添加/修改 -->
+  <ScoreForm ref="formRef" @success="getList" />
+</template>
+
+<script setup lang="ts">
+import { dateFormatter } from '@/utils/formatTime'
+import download from '@/utils/download'
+import { ScoreApi, ScoreVO } from '@/api/work/score'
+import ScoreForm from './ScoreForm.vue'
+
+/** 作品评分 列表 */
+defineOptions({ name: 'Score' })
+
+const message = useMessage() // 消息弹窗
+const { t } = useI18n() // 国际化
+
+const loading = ref(true) // 列表的加载中
+const list = ref<ScoreVO[]>([]) // 列表的数据
+const total = ref(0) // 列表的总页数
+const queryParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  workId: undefined,
+  score: undefined,
+  createTime: []
+})
+const queryFormRef = ref() // 搜索的表单
+const exportLoading = ref(false) // 导出的加载中
+
+/** 查询列表 */
+const getList = async () => {
+  loading.value = true
+  try {
+    const data = await ScoreApi.getScorePage(queryParams)
+    list.value = data.list
+    total.value = data.total
+  } finally {
+    loading.value = false
+  }
+}
+
+/** 搜索按钮操作 */
+const handleQuery = () => {
+  queryParams.pageNo = 1
+  getList()
+}
+
+/** 重置按钮操作 */
+const resetQuery = () => {
+  queryFormRef.value.resetFields()
+  handleQuery()
+}
+
+/** 添加/修改操作 */
+const formRef = ref()
+const openForm = (type: string, id?: number) => {
+  formRef.value.open(type, id)
+}
+
+/** 删除按钮操作 */
+const handleDelete = async (id: number) => {
+  try {
+    // 删除的二次确认
+    await message.delConfirm()
+    // 发起删除
+    await ScoreApi.deleteScore(id)
+    message.success(t('common.delSuccess'))
+    // 刷新列表
+    await getList()
+  } catch {}
+}
+
+/** 导出按钮操作 */
+const handleExport = async () => {
+  try {
+    // 导出的二次确认
+    await message.exportConfirm()
+    // 发起导出
+    exportLoading.value = true
+    const data = await ScoreApi.exportScore(queryParams)
+    download.excel(data, '作品评分.xls')
+  } catch {
+  } finally {
+    exportLoading.value = false
+  }
+}
+
+/** 初始化 **/
+onMounted(() => {
+  getList()
+})
+</script>

+ 9 - 0
src/api/work/score/index.ts

@@ -20,6 +20,15 @@ export const ScoreApi = {
     return await request.get({ url: `/work/score/get?id=` + id })
   },
 
+  // 查询作品评分详情
+  getScoreStatus: async () => {
+    return await request.get({ url: `/work/score/getStatus` })
+  },
+  // 查询作品评分详情
+  getScoreInfo: async () => {
+    return await request.get({ url: `/work/score/getScoreInfo` })
+  },
+
   // 新增作品评分
   createScore: async (data: ScoreVO) => {
     return await request.post({ url: `/work/score/create`, data })

+ 149 - 19
src/views/work/score/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="common-layout" style="width: 100%" v-loading="loading">
-    <el-container v-if="pageAndPage">
+    <el-container v-if="pageAndPage===0">
       <el-aside width="300" style="margin-right: 10px;margin-top: 20px">
 
         <el-card class="infinite-list"
@@ -32,16 +32,19 @@
           <el-col :span="8" style="padding: 20px;">
             <el-card style="height: 100px;">
               总作品数量
+              {{ scoreStatus.all }}
             </el-card>
           </el-col>
           <el-col :span="8" style="padding: 20px;">
             <el-card style="height: 100px;">
               已评作品数量
+              {{ scoreStatus.finish }}
             </el-card>
           </el-col>
           <el-col :span="8" style="padding: 20px;">
             <el-card style="height: 100px;">
               未评作品数量
+              {{ scoreStatus.remain }}
             </el-card>
           </el-col>
         </el-row>
@@ -61,7 +64,8 @@
             </el-button>
           </el-col>
           <el-col :span="12" style="padding: 20px">
-            <el-button style="width: 100%;height: 400px;font-size: 90px;min-width: 400px">
+            <el-button style="width: 100%;height: 400px;font-size: 90px;min-width: 400px"
+                       @click="pageAndPage=2">
               查看详情
             </el-button>
           </el-col>
@@ -73,7 +77,7 @@
       </el-main>
     </el-container>
 
-    <el-container v-if="!pageAndPage">
+    <el-container v-if="pageAndPage===1">
       <el-aside width="300" style="margin-right: 10px">
         <el-card class="infinite-list"
                  style="margin: auto;width: 300px;max-height:700px;min-height:80px;padding: 1px">
@@ -189,6 +193,116 @@
       </el-container>
     </el-container>
 
+    <div v-if="pageAndPage===2">
+      <ContentWrap>
+        <!-- 搜索工作栏 -->
+        <el-form
+          class="-mb-15px"
+          :model="queryParams"
+          ref="queryFormRef"
+          :inline="true"
+          label-width="68px"
+        >
+          <el-form-item label="作品编号" prop="workId">
+            <el-input
+              v-model="queryParams.workId"
+              placeholder="请输入作品id"
+              clearable
+              @keyup.enter="handleQuery"
+              class="!w-240px"
+            />
+          </el-form-item>
+          <el-form-item label="评分" prop="score">
+            <el-input
+              v-model="queryParams.score"
+              placeholder="请输入评分"
+              clearable
+              @keyup.enter="handleQuery"
+              class="!w-240px"
+            />
+          </el-form-item>
+          <el-form-item label="评分时间" prop="createTime">
+            <el-date-picker
+              v-model="queryParams.createTime"
+              value-format="YYYY-MM-DD HH:mm:ss"
+              type="daterange"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+              class="!w-220px"
+            />
+          </el-form-item>
+          <el-form-item>
+            <el-button @click="handleQuery">
+              <Icon icon="ep:search" class="mr-5px"/>
+              搜索
+            </el-button>
+            <el-button @click="resetQuery">
+              <Icon icon="ep:refresh" class="mr-5px"/>
+              重置
+            </el-button>
+
+            <el-button
+              type="success"
+              plain
+              @click="handleExport"
+              :loading="exportLoading"
+              v-hasPermi="['work:score:export']"
+            >
+              <Icon icon="ep:download" class="mr-5px"/>
+              导出
+            </el-button>
+            <el-button
+              type="primary"
+              plain
+              @click="pageAndPage=0"
+              v-hasPermi="['work:score:create']"
+            >
+              返回上一页
+            </el-button>
+          </el-form-item>
+        </el-form>
+      </ContentWrap>
+
+      <!-- 列表 -->
+      <ContentWrap>
+        <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
+          <el-table-column label="作品编号" align="center" prop="workId" width="100"/>
+          <el-table-column label="作品名" align="center" width="400">
+            <template #default="scope">
+              {{ scope.row.workDO.workName }}
+            </template>
+          </el-table-column>
+          <el-table-column label="评分" align="center" prop="score" width="150"/>
+          <el-table-column label="状态" align="center" width="150">
+            <template #default="scope">
+              <el-button v-if="scope.row.status==='1'" type="success" size="small">
+                已提交
+              </el-button>
+              <el-button v-if="scope.row.status==='0'" type="info" size="small">
+                未提交
+              </el-button>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="评分时间"
+            align="center"
+            prop="createTime"
+            :formatter="dateFormatter"
+          />
+        </el-table>
+        <!-- 分页 -->
+        <Pagination
+          :total="total"
+          v-model:page="queryParams.pageNo"
+          v-model:limit="queryParams.pageSize"
+          @pagination="getList"
+        />
+      </ContentWrap>
+
+
+    </div>
+
 
     <!--=======================================    -->
 
@@ -208,7 +322,7 @@
 </template>
 
 <script setup lang="ts">
-
+import {dateFormatter} from '@/utils/formatTime'
 import {c} from "vite/dist/node/types.d-jgA8ss1A";
 
 const visible = ref(false)
@@ -258,8 +372,8 @@ const handleSave = () => {
   try {
     const data = formDataScope.value as unknown as ScoreVO
 
-       ScoreApi.updateScoreStatus(data)
-      message.success(t('common.updateSuccess'))
+    ScoreApi.updateScoreStatus(data)
+    message.success(t('common.updateSuccess'))
 
     file.value.score = formDataScope.value.score
     visible.value = false
@@ -267,10 +381,11 @@ const handleSave = () => {
     emit('success')
   } finally {
     formLoading.value = false
-    pageAndPage.value=true
+    pageAndPage.value = 0
     file.value = {score: undefined, workName: "", manuscriptAndMaterial: "", format: "", url: ""}
-    workList.value=undefined
+    workList.value = undefined
   }
+  getScoreStatus()
   getTypeList()
   getList()
 }
@@ -281,7 +396,7 @@ const uploadBase64Image = (base64Data, contentType = 'image/png') => {
   formData.append('file', blob, 'image.png'); // 你可以根据需要更改文件名
 
   workApi.uploadFiles(formData).then(data => {
-    formDataScope.value.url=data.url
+    formDataScope.value.url = data.url
   })
 }
 const base64ToBlob = (base64Data, contentType = 'image/png') => {
@@ -296,7 +411,7 @@ const base64ToBlob = (base64Data, contentType = 'image/png') => {
 }
 //=======================================================
 
-import { ElMessage } from 'element-plus'
+import {ElMessage} from 'element-plus'
 import download from '@/utils/download'
 import {ScoreApi, ScoreVO} from '@/api/work/score'
 import {TypeApi} from "@/api/work/type";
@@ -316,14 +431,10 @@ const formRules = reactive({})
 
 /** 返回开始评分界面 */
 const returnScope = () => {
-  pageAndPage.value = true
-  workList.value = []
-}
-/** 提交 */
-const subStatus = () => {
-  pageAndPage.value = true
+  pageAndPage.value = 0
   workList.value = []
 }
+
 /** 下一个 */
 const nextScope = () => {
   if (indexScore.value === workList.value.length) {
@@ -404,7 +515,7 @@ const scrollToSection = (sectionId) => {
 //=================================
 
 
-const pageAndPage = ref(true)
+const pageAndPage = ref(0)
 
 const file = ref({
   format: '',
@@ -449,6 +560,11 @@ interface Tree {
 
 const loading = ref(true) // 列表的加载中
 const list = ref<ScoreVO[]>([]) // 列表的数据
+const scoreStatus = ref({
+  all: 0,
+  finish: 0,
+  remain: 0
+}) // 个人评分统计
 const typeList = ref([]) // 列表的数据
 const total = ref(0) // 列表的总页数
 const queryParams = reactive({//评分查询参数
@@ -472,7 +588,7 @@ const handleNodeClick = () => {
 
   file.value = {score: undefined, workName: "", manuscriptAndMaterial: "", format: "", url: ""}
   workQueryParams.categoryId = startType.value.id
-  if (workQueryParams.categoryId===''){
+  if (workQueryParams.categoryId === '') {
     ElMessage({
       message: '当前没有您要评的作品!',
       type: 'warning',
@@ -573,7 +689,7 @@ const getWorkLists = async () => {
       formDataScope.value.score = workList.value[indexScore.value].scoreDO.score
       formDataScope.value.id = workList.value[indexScore.value].scoreDO.id
       formDataScope.value.workId = workList.value[indexScore.value].workId
-      pageAndPage.value = false
+      pageAndPage.value = 1
     }
   } finally {
     loading.value = false
@@ -590,11 +706,24 @@ const getList = async () => {
     loading.value = false
   }
 }
+/** 查询列表 */
+const getScoreStatus = async () => {
+  loading.value = true
+  try {
+    const data = await ScoreApi.getScoreStatus()
+    scoreStatus.value = data
+    console.log(scoreStatus.value)
+    console.log(data)
+  } finally {
+    loading.value = false
+  }
+}
 
 /** 搜索按钮操作 */
 const handleQuery = () => {
   queryParams.pageNo = 1
   getList()
+
 }
 
 /** 重置按钮操作 */
@@ -673,6 +802,7 @@ const handleExport = async () => {
 onMounted(() => {
   getTypeList()
   getList()
+  getScoreStatus()
 })
 </script>
 <style>