zhouwx
2025-06-10 c8c99bf1f753e27c4d99a0ff6058ce16f973f9c4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<template>
  <div class="notice">
    <el-dialog
        v-model="dialogVisible"
        :title="state.title"
        width="50%"
        :before-close="handleClose"
        :close-on-press-escape="false"
        :close-on-click-modal="false"
    >
      <el-table v-loading="state.loading" :data="state.dataList" :border="true">
        <el-table-column label="创建时间" prop="createTime" align="center"  width="180" />
        <el-table-column label="变动来源" prop="origin" align="center"  />
        <el-table-column label="变动情况" prop="modifyPeriodMin" align="center" />
        <el-table-column label="变动后剩余" prop="remainPeriodMin" align="center"  />
<!--        <el-table-column label="操作" align="center" class-name="small-padding fixed-width"  width="180">-->
<!--          <template #default="scope">-->
<!--            <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>-->
<!--          </template>-->
<!--        </el-table-column>-->
      </el-table>
      <pagination
        v-show="state.total > 0"
        :total="state.total"
        v-model:page="state.queryParams.pageNum"
        v-model:limit="state.queryParams.pageSize"
        @pagination="getList"
      />
    </el-dialog>
  </div>
</template>
<script setup>
import {reactive, ref, toRefs} from 'vue'
import {ElMessage} from "element-plus";
 
import {
  getClassification
} from "@/api/onlineEducation/courseClass";
import {addCourse, checkCourseName, editCourse, getCourseById} from "@/api/onlineEducation/courseManage";
import {getToken} from "@/utils/auth";
import {delPic, getBannerById} from "@/api/onlineEducation/banner";
import Cookies from "js-cookie";
import {addQuestionBank, checkQuestionBankName, editQuestionBank} from "@/api/onlineEducation/questionBank";
import {getBatch, getCompanyPeriod} from "@/api/onlineEducation/batch";
 
const dialogVisible = ref(false);
const title = ref("");
const busRef = ref();
const length = ref()
const emit = defineEmits(["getList"]);
const startUsername = ref('');
const classifyRef = ref(null)
 
const state = reactive({
  loading: false,
  dataList: [],
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    companyId: null
  },
  total: 0,
  title: ''
})
 
const openDialog = async (value) => {
  state.title = '课时余量变动明细'
  dialogVisible.value = true;
  state.queryParams.companyId = value
  await getList()
}
const getList = async () => {
  state.loading = true
  const res = await getCompanyPeriod(state.queryParams)
  if(res.code == 200){
    state.dataList = res.data.list.map(item => {
      return {
        ...item,
        modifyPeriodMin: item.modifyPeriod ? item.modifyPeriod >0 ?'新增 '+(item.modifyPeriod /60).toFixed(2).replace(/\.00$/, '')+'分钟':'减少 '+ (Math.abs(item.modifyPeriod /60)).toFixed(2).replace(/\.00$/, '')+'分钟'  : '',
        remainPeriodMin: item.remainPeriod ? (item.remainPeriod  /60).toFixed(2).replace(/\.00$/, '')+'分钟' : ''
      }
    })
    state.total = res.data.total
  }else{
    ElMessage.warning(res.message)
  }
  state.loading = false
}
 
const handleClose = () => {
  dialogVisible.value = false;
  emit("getList")
 
}
 
defineExpose({
  openDialog
});
 
</script>
 
<style scoped lang="scss">
.notice{
  :deep(.el-form .el-form-item__label) {
    font-size: 15px;
  }
  .file {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
}
</style>