Browse Source

fix: misc

dev
hechang27-sprt 6 months ago
parent
commit
d56310e84f
  1. 3
      packages/base/item/tzDatePicker.vue
  2. 4
      packages/base/item/tzDateTime.vue
  3. 4
      plugs/composables/useListTable.ts
  4. 5
      plugs/composables/useSysDict.ts
  5. 13
      plugs/http/axios3.ts

3
packages/base/item/tzDatePicker.vue

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<template>
<el-date-picker v-model="model"> </el-date-picker>
<el-date-picker v-model="model" />
</template>
<script setup lang="ts">
@ -50,5 +50,6 @@ const model = defineModel<string | number, string, Date, Date>({ @@ -50,5 +50,6 @@ const model = defineModel<string | number, string, Date, Date>({
else return isoWithMillis.slice(0, 19).concat("Z");
}
},
default: () => new Date(),
});
</script>

4
packages/base/item/tzDateTime.vue

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
<template>
{{ display }}
<slot v-if="slot" :display="display" />
<template v-else>{{ display }}</template>
</template>
<script setup lang="ts">
import dayjs from "dayjs";
@ -13,6 +14,7 @@ interface Props { @@ -13,6 +14,7 @@ interface Props {
displayFormat?: string;
locale?: string;
type?: "iso8601" | "unix" | "unixMillis";
slot?: boolean;
}
const props = defineProps<Props>();

4
plugs/composables/useListTable.ts

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
import { toReactive } from "@vueuse/core";
import { reactive, ref, shallowRef, watchEffect } from "vue";
import { reactive, ref, toRaw, shallowRef, watchEffect } from "vue";
import * as Element from "../element";
import { useI18n } from "vue3-i18n";
import { PageResponse } from "../http";
@ -66,7 +66,7 @@ export function useListTable(options: Options) { @@ -66,7 +66,7 @@ export function useListTable(options: Options) {
const query = async () => {
try {
const resp = await options.query(example);
const resp = await options.query(toRaw(example));
setRows(resp);
} catch (error) {
showMessage("error", t("common.errors.listTableQueryError"));

5
plugs/composables/useSysDict.ts

@ -1,10 +1,11 @@ @@ -1,10 +1,11 @@
import { computed } from "vue";
import { useStore } from "vuex";
type Callback = () => Record<string, string> | Promise<Record<string, string>>;
const callbacks: Record<string, Callback> = {};
export function useSysDict() {
type Callback = () => Record<string, string> | Promise<Record<string, string>>;
const store = useStore();
const callbacks: Record<string, Callback> = {};
const normalize = (content: Record<string, string>) => {
if (content == null) return {};

13
plugs/http/axios3.ts

@ -29,10 +29,11 @@ export const registerRouter = (routerP) => { @@ -29,10 +29,11 @@ export const registerRouter = (routerP) => {
_axios.interceptors.request.use(
function (config) {
const time = new Date().getTime().toString();
const params = config.params;
if (params) {
const params = new URLSearchParams(config.params);
if (params.toString()) {
delEmpty(params);
params.t = time;
params.append("t", time);
config.params = params;
}
const data = config.data;
if (data != null && typeof data === "object") {
@ -47,7 +48,11 @@ _axios.interceptors.request.use( @@ -47,7 +48,11 @@ _axios.interceptors.request.use(
);
function delEmpty(data) {
if (data) {
if (data && data instanceof URLSearchParams) {
for (const [k, v] of data.entries()) {
if (!v) data.delete(k);
}
} else if (data && typeof data === "object") {
for (const item in data) {
if (data.hasOwnProperty(item)) {
const val = data[item];

Loading…
Cancel
Save