|
@@ -0,0 +1,237 @@
|
|
|
+<template>
|
|
|
+ <BasicModal
|
|
|
+ @ok="handleSubmit"
|
|
|
+ :destroyOnClose="true"
|
|
|
+ :maskClosable="false"
|
|
|
+ v-bind="$attrs"
|
|
|
+ @register="registerModal"
|
|
|
+ :title="getTitle"
|
|
|
+ :width="1002"
|
|
|
+ showFooter
|
|
|
+ :defaultFullscreen="true"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <div style="height: 122px">
|
|
|
+ <Descriptions bordered>
|
|
|
+ <Descriptions.Item label="年月">
|
|
|
+ {{ modelRef?.year }}年{{ modelRef?.month }}月
|
|
|
+ </Descriptions.Item>
|
|
|
+ <Descriptions.Item label="时间">
|
|
|
+ {{ formatToDate(modelRef?.startDate) }}~{{ formatToDate(modelRef?.endDate) }}
|
|
|
+ </Descriptions.Item>
|
|
|
+ <Descriptions.Item label="总课时">
|
|
|
+ {{ modelRef?.allClassTime }}
|
|
|
+ </Descriptions.Item>
|
|
|
+ <Descriptions.Item label="总周次">
|
|
|
+ {{ modelRef?.weeks }}
|
|
|
+ </Descriptions.Item>
|
|
|
+ <Descriptions.Item label="超工作量基数">
|
|
|
+ <div class="flex">
|
|
|
+ <InputNumber
|
|
|
+ v-model:value="state.overWorkloadNumber"
|
|
|
+ style="width: 100px"
|
|
|
+ :disabled="state.overWorkloadNumberStatus === 1"
|
|
|
+ :min="0"
|
|
|
+ />
|
|
|
+ <a-button
|
|
|
+ class="ml-2"
|
|
|
+ type="primary"
|
|
|
+ v-if="state.overWorkloadNumberStatus === 0"
|
|
|
+ @click="handelChangeNumber"
|
|
|
+ >
|
|
|
+ 修改
|
|
|
+ </a-button>
|
|
|
+ <a-button
|
|
|
+ class="ml-2"
|
|
|
+ type="primary"
|
|
|
+ :disabled="state.overWorkloadNumberStatus === 1"
|
|
|
+ @click="handelStatus"
|
|
|
+ >
|
|
|
+ 锁定
|
|
|
+ </a-button>
|
|
|
+ </div>
|
|
|
+ </Descriptions.Item>
|
|
|
+ </Descriptions>
|
|
|
+ </div>
|
|
|
+ <div style="height: calc(100% - 122px)">
|
|
|
+ <BasicTable @register="registerTable" :searchInfo="searchInfo">
|
|
|
+ <template #toolbar>
|
|
|
+ <a-button type="primary" @click="handelRefrresh" :disabled="modelRef?.status === 3">
|
|
|
+ 刷新统计
|
|
|
+ </a-button>
|
|
|
+ <a-button type="primary" @click="handelImport">行政工作量导入</a-button>
|
|
|
+ <a-button type="primary" @click="handleWeight">权重设置</a-button>
|
|
|
+ <a-button type="primary" @click="handleExport">导出</a-button>
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <FormWeight @register="registerWeightModal" />
|
|
|
+ <FormImport @register="registerImportModal" @success="handleSuccess" />
|
|
|
+ </BasicModal>
|
|
|
+</template>
|
|
|
+<script setup lang="ts">
|
|
|
+ import { ref, computed, unref, reactive } from 'vue';
|
|
|
+ import { BasicModal, useModal, useModalInner } from '/@/components/Modal';
|
|
|
+ import { formDetailSchema } from '../data.config';
|
|
|
+ import {
|
|
|
+ getClassTimeStatisticsInfo,
|
|
|
+ getClassTimeStatisticsRecordList,
|
|
|
+ postClassTimeStatisticsChangeStatus,
|
|
|
+ postClassTimeStatisticsExportQuery,
|
|
|
+ postClassTimeStatisticsImport,
|
|
|
+ postClassTimeStatisticsOverWorkloadNumber,
|
|
|
+ postClassTimeStatisticsOverWorkloadNumberStatus,
|
|
|
+ postClassTimeStatisticsRefreshStatistics,
|
|
|
+ } from '/@/services/apis/CourseClassTimeStatisticsController';
|
|
|
+ import { useTable, BasicTable } from '/@/components/Table';
|
|
|
+ import { Descriptions, InputNumber } from 'ant-design-vue';
|
|
|
+ import FormWeight from './weight.vue';
|
|
|
+ import { formatToDate } from '/@/utils/dateUtil';
|
|
|
+ import { downloadByData } from '/@/utils/file/download';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ import FormImport from '/@/views/sys/import/index.vue';
|
|
|
+
|
|
|
+ const isUpdate = ref(true);
|
|
|
+ const modelRef = ref<Recordable>({});
|
|
|
+ const searchInfo = reactive<Recordable>({});
|
|
|
+ const emit = defineEmits(['success', 'register']);
|
|
|
+ const [registerWeightModal, { openModal: openWeightModal }] = useModal();
|
|
|
+
|
|
|
+ const [registerImportModal, { openModal: openImportModal }] = useModal();
|
|
|
+
|
|
|
+ const { createMessage } = useMessage();
|
|
|
+ const state = reactive({
|
|
|
+ status: 0,
|
|
|
+ overWorkloadNumber: 0,
|
|
|
+ overWorkloadNumberStatus: 0,
|
|
|
+ });
|
|
|
+
|
|
|
+ const [registerTable, { reload }] = useTable({
|
|
|
+ api: getClassTimeStatisticsRecordList,
|
|
|
+ title: '课时统计表',
|
|
|
+ rowKey: 'id',
|
|
|
+ columns: formDetailSchema,
|
|
|
+ useSearchForm: false,
|
|
|
+ showTableSetting: true,
|
|
|
+ bordered: true,
|
|
|
+ immediate: false,
|
|
|
+ canResize: true,
|
|
|
+ pagination: false,
|
|
|
+ });
|
|
|
+
|
|
|
+ const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
|
|
|
+ setModalProps({
|
|
|
+ confirmLoading: true,
|
|
|
+ okText: data.baseData.status === 1 || data.baseData.status === 2 ? '锁定' : '解锁',
|
|
|
+ cancelText: '关闭',
|
|
|
+ okButtonProps: { disabled: data.baseData.status === 0 },
|
|
|
+ });
|
|
|
+ isUpdate.value = false;
|
|
|
+ state.status = data.baseData.status;
|
|
|
+
|
|
|
+ const resData = await getClassTimeStatisticsInfo({ id: data.baseData.id });
|
|
|
+ modelRef.value = { ...resData };
|
|
|
+ state.overWorkloadNumber = resData.overWorkloadNumber || 0;
|
|
|
+ state.overWorkloadNumberStatus = resData.overWorkloadNumberStatus || 0;
|
|
|
+ searchInfo.id = data.baseData.id;
|
|
|
+
|
|
|
+ reload();
|
|
|
+ setModalProps({ confirmLoading: false });
|
|
|
+ });
|
|
|
+
|
|
|
+ const getTitle = computed(() => (!unref(isUpdate) ? '统计明细' : '统计明细'));
|
|
|
+ const handleSubmit = async () => {
|
|
|
+ try {
|
|
|
+ setModalProps({ loading: true, confirmLoading: true });
|
|
|
+ await postClassTimeStatisticsChangeStatus({
|
|
|
+ id: modelRef.value.id,
|
|
|
+ status: state.status === 3 ? 2 : 3,
|
|
|
+ });
|
|
|
+ closeModal();
|
|
|
+
|
|
|
+ emit('success');
|
|
|
+ } finally {
|
|
|
+ setModalProps({ loading: false, confirmLoading: false });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleWeight = () => {
|
|
|
+ openWeightModal(true, {
|
|
|
+ isUpdate: true,
|
|
|
+ baseData: {
|
|
|
+ classTimeStatisticsId: unref(modelRef).id,
|
|
|
+ jsonContent: unref(modelRef).weightSetJson,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const handelRefrresh = async () => {
|
|
|
+ try {
|
|
|
+ setModalProps({ loading: true, confirmLoading: true });
|
|
|
+ await postClassTimeStatisticsRefreshStatistics({ id: unref(modelRef).id });
|
|
|
+ closeModal();
|
|
|
+
|
|
|
+ emit('success');
|
|
|
+ } finally {
|
|
|
+ setModalProps({ loading: false, confirmLoading: false });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleExport = async () => {
|
|
|
+ setModalProps({ loading: true, confirmLoading: true });
|
|
|
+ downloadByData(
|
|
|
+ (await postClassTimeStatisticsExportQuery({ id: unref(modelRef).id })).data,
|
|
|
+ `课时量统计${formatToDate(new Date())}.xlsx`,
|
|
|
+ );
|
|
|
+ setModalProps({ loading: false, confirmLoading: false });
|
|
|
+ };
|
|
|
+
|
|
|
+ const handelStatus = async () => {
|
|
|
+ try {
|
|
|
+ setModalProps({ loading: true, confirmLoading: true });
|
|
|
+ await postClassTimeStatisticsOverWorkloadNumberStatus({ id: unref(modelRef).id, status: 1 });
|
|
|
+ state.overWorkloadNumberStatus = 1;
|
|
|
+ createMessage.success('锁定成功');
|
|
|
+ } catch {
|
|
|
+ createMessage.error('锁定失败');
|
|
|
+ } finally {
|
|
|
+ setModalProps({ loading: false, confirmLoading: false });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const handelChangeNumber = async () => {
|
|
|
+ try {
|
|
|
+ setModalProps({ loading: true, confirmLoading: true });
|
|
|
+ await postClassTimeStatisticsOverWorkloadNumber({
|
|
|
+ id: unref(modelRef).id,
|
|
|
+ overWorkloadNumber: state.overWorkloadNumber,
|
|
|
+ });
|
|
|
+ createMessage.success('修改成功');
|
|
|
+ } catch {
|
|
|
+ createMessage.error('修改失败');
|
|
|
+ } finally {
|
|
|
+ setModalProps({ loading: false, confirmLoading: false });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const handelImport = () => {
|
|
|
+ openImportModal(true, {
|
|
|
+ baseData: {
|
|
|
+ title: '行政工作量',
|
|
|
+ upload: postClassTimeStatisticsImport,
|
|
|
+ params: {},
|
|
|
+ errorName: '行政工作量导入错误数据',
|
|
|
+ templatePath:
|
|
|
+ 'https://zhxy.cqtlzjzx.com/minio/static/resources/%E8%A1%8C%E6%94%BF%E5%B7%A5%E4%BD%9C%E9%87%8F%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx',
|
|
|
+ templateName: '行政工作量模板',
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleSuccess = () => {
|
|
|
+ reload();
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="less"></style>
|