zcwy-dev 补充

This commit is contained in:
lims1@hunktimes.com
2023-08-01 20:53:35 +08:00
21 changed files with 22659 additions and 148 deletions

22375
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,136 @@
<template>
<a-table :customRow="customRow" class="ant-table-striped"
:row-class-name="(_, index) => (index % 2 === 1 ? 'table-striped' : null)" row-key="id" :columns="columns"
:data-source="data" :loading="loading" :pagination="pagination" :row-selection="rowSelection">
<template #operation="{ record }">
<slot :record="record"></slot>
</template>
</a-table>
</template>
<script setup>
import { defineProps, defineExpose, ref, computed, onMounted, defineEmits, nextTick } from "vue";
import { useRowsPageNoInit } from "@/api/request";
import { useResetRef } from "@/utils/useCommon";
const props = defineProps({
type: {
type: String,
default: ""
},
columns: {
type: Array,
default: () => []
},
url: {
type: String,
default: ""
},
pageKey: {
type: String,
default: "pageNo"
},
params: {
type: Object,
default: () => ({})
},
init: {
type: Boolean,
default: true
},
request: {
type: Function,
default: useRowsPageNoInit
}
});
const emit = defineEmits(["update:params", "update:selectedRowKeys", "update:selectedRows"]);
const rowSelectKeys = ref([]);
const selectsData = ref([]);
const params = useResetRef({ [props.pageKey]: 1, pageSize: 10 });
const postParam = computed(() => ({ ...params.value, ...props.params }));
const { data, loading, total, fetch: onFetch } = props.request(props.url, postParam);
const rowSelection = computed(() => (props.type ? {
type: props.type,
columnWidth: 20,
selectedRowKeys: rowSelectKeys.value,
onChange: onSelectChange,
preserveSelectedRowKeys: true,
} : null));
const customRow = (record) => ({
onClick: () => {
if (props.type === "checkbox") {
if (rowSelectKeys.value.some(t => t === record.id)) {
rowSelectKeys.value = rowSelectKeys.value.filter(t => t !== record.id);
selectsData.value = selectsData.value.filter(t => t.id !== record.id);
} else {
rowSelectKeys.value.push(record.id);
selectsData.value.push(record);
}
} else {
rowSelectKeys.value = [record.id];
selectsData.value = [record];
}
emit("update:selectedRowKeys", [...rowSelectKeys.value]);
emit("update:selectedRows", [...selectsData.value]);
}
});
onMounted(() => props.init && nextTick(onFetch));
function onSelectChange(e, l) {
rowSelectKeys.value = e;
selectsData.value = l;
emit("update:selectedRowKeys", e);
emit("update:selectedRows", l);
}
const pagination = computed(() => ({
total: total.value,
showSizeChanger: false,
current: params.value[props.pageKey],
pageSize: params.value.pageSize,
onChange: changePagination,
}));
const changePagination = (e) => {
params.value[props.pageKey] = e;
nextTick(onFetch);
};
function reset(v) {
params.reset();
v && emit("update:params", { ...v });
nextTick(onFetch);
}
function resetSelected() {
rowSelectKeys.value = [];
selectsData.value = [];
emit("update:selectedRowKeys", []);
emit("update:selectedRows", []);
}
function clear(v) {
rowSelectKeys.value = [];
selectsData.value = [];
params.reset();
v && emit("update:params", { ...v });
emit("update:selectedRowKeys", []);
emit("update:selectedRows", []);
}
const toLoading = () => loading.value = true;
function remove(i) {
rowSelectKeys.value.splice(i, 1);
selectsData.value.splice(i, 1);
emit("update:selectedRowKeys", rowSelectKeys.value);
emit("update:selectedRows", selectsData.value);
}
const fetch = () => nextTick(onFetch);
defineExpose({ fetch, reset, resetSelected, clear, toLoading, remove });
</script>

View File

@@ -282,7 +282,7 @@
<!-- 二维码弹窗 -->
</template>
<script>
<script lang="jsx">
import { toRefs, reactive } from "vue";
import SignQR from "./SignQR.vue";
import TwoDimensionalCode from "../../components/TwoDimensionalCode";

View File

@@ -114,7 +114,7 @@
</a-drawer>
</template>
<script>
<script lang="jsx">
import { toRefs, reactive, onMounted, onUnmounted } from "vue";
import { message } from "ant-design-vue";
// import * as api from "../../../api/index";

View File

@@ -120,7 +120,7 @@
<CheckAnsware v-model:CAvisible="CAvisible" :datasource="datasource1"/>
</template>
<script>
<script lang="jsx">
import { toRefs, reactive } from "vue";
import { message } from "ant-design-vue";
import EScore from "../ExportScore.vue";

View File

@@ -126,7 +126,7 @@
</a-drawer>
</template>
<script>
<script lang="jsx">
import { toRefs, reactive } from "vue";
import { message } from "ant-design-vue";
import ExportAchievement from "../ExportAchievement.vue";

View File

@@ -133,7 +133,7 @@
:downloadUrl="downloadUrl"
/>
</template>
<script setup>
<script setup lang="jsx">
import {computed, defineEmits, ref, watch} from "vue";
import * as api from "@/api/index1";
import BaseTable from "@/components/common/BaseTable";

View File

@@ -158,7 +158,7 @@
/>
</template>
<script>
<script lang="jsx">
import { toRefs, reactive } from "vue";
import { message } from "ant-design-vue";
import CKWork from "../CheckWork.vue";

View File

@@ -132,7 +132,7 @@
:basicdata="datasource.info" />
</template>
<script>
<script lang="jsx">
import { toRefs, reactive, onMounted, onUnmounted } from "vue";
import { message } from "ant-design-vue";
// import * as api from "../../../api/index";

View File

@@ -119,7 +119,7 @@
/>
</template>
<script>
<script lang="jsx">
import { toRefs, reactive, onMounted, onUnmounted } from "vue";
import { message } from "ant-design-vue";
// import * as api from "../../../api/index";

View File

@@ -132,7 +132,7 @@
:basicdata="datasource.info" />
</template>
<script>
<script lang="jsx">
import { toRefs, reactive, onMounted, onUnmounted } from "vue";
import { message } from "ant-design-vue";
import ViewAssess from "../ViewAssess";

View File

@@ -112,7 +112,7 @@
</a-drawer>
</template>
<script>
<script lang="jsx">
import { toRefs, reactive, onMounted, onUnmounted } from "vue";
import { message } from "ant-design-vue";
// import * as api from "../../../api/index";

View File

@@ -125,7 +125,7 @@
</a-drawer>
</template>
<script>
<script lang="jsx">
import { toRefs, reactive } from "vue";
import { message } from "ant-design-vue";
import ExportAchievement from "../ExportAchievement.vue";

View File

@@ -82,7 +82,7 @@
<CheckAnsware v-model:CAvisible="CAvisible" :datasource="datasource1" />
</template>
<script>
<script lang="jsx">
import { toRefs, reactive } from "vue";
import { message } from "ant-design-vue";
import EScore from "../ExportScore.vue";

View File

@@ -150,7 +150,7 @@
</a-drawer>
</template>
<script setup>
<script setup lang="jsx">
import {computed, defineEmits, ref, watch} from "vue";
import * as api from "@/api/index1";
import BaseTable from "@/components/common/BaseTable";

View File

@@ -101,7 +101,7 @@
<ExportHomeWork v-model:exportHomeWorkV="exportHomeWorkV" :downloadUrl="downloadUrl" />
</template>
<script>
<script lang="jsx">
import { toRefs, reactive } from "vue";
import { message } from "ant-design-vue";
import CKWork from "../CheckWork.vue";

View File

@@ -120,7 +120,7 @@
/>
</template>
<script>
<script lang="jsx">
import { toRefs, reactive, onMounted, onUnmounted } from "vue";
import { message } from "ant-design-vue";
import SeeStu from "@/components/drawers/SeeStu";

View File

@@ -119,7 +119,7 @@
/>
</template>
<script>
<script lang="jsx">
import { toRefs, reactive, onMounted, onUnmounted } from "vue";
import { message } from "ant-design-vue";
// import * as api from "../../../api/index";