diff --git a/src/api/car/carRecord.ts b/src/api/car/carRecord.ts index c6780b3..8a56293 100644 --- a/src/api/car/carRecord.ts +++ b/src/api/car/carRecord.ts @@ -1,70 +1,81 @@ -import request from "/@/utils/request" +import request from "/@/utils/request"; -/* start 人闸统计 start */ +/* start 车闸统计 start */ + +export function beLateRecordPage(data: any) { + return request({ + url: "/admin/car/total/be-late-page", + method: "post", + params: { + current: data.current, + size: data.size, + }, + data, + }); +} export function totalPage(params: any) { return request({ - url: '/admin/car/total/page', - method: 'get', + url: "/admin/car/total/page", + method: "get", params, - }) + }); } // 军车出车次数(根据时间类型) export function armyCarCountByDateType(data: any) { return request({ - url: '/admin/car/total/army-car-count-by-date-type', - method: 'post', + url: "/admin/car/total/army-car-count-by-date-type", + method: "post", data, - }) + }); } /* end 人闸统计 end */ export function dataCleaning(data?: Object) { return request({ - url: '/admin/car/carRecord/data-cleaning', - method: 'post', + url: "/admin/car/carRecord/data-cleaning", + method: "post", data, - }) + }); } export function fetchList(query?: Object) { return request({ - url: '/admin/car/carRecord/page', - method: 'get', - params: query - }) + url: "/admin/car/carRecord/page", + method: "get", + params: query, + }); } export function addObj(obj?: Object) { return request({ - url: '/admin/car/carRecord', - method: 'post', - data: obj - }) + url: "/admin/car/carRecord", + method: "post", + data: obj, + }); } export function getObj(id?: string) { return request({ - url: '/admin/car/carRecord/' + id, - method: 'get' - }) + url: "/admin/car/carRecord/" + id, + method: "get", + }); } export function delObjs(ids?: Object) { return request({ - url: '/admin/car/carRecord', - method: 'delete', - data: ids - }) + url: "/admin/car/carRecord", + method: "delete", + data: ids, + }); } export function putObj(obj?: Object) { return request({ - url: '/admin/car/carRecord', - method: 'put', - data: obj - }) + url: "/admin/car/carRecord", + method: "put", + data: obj, + }); } - diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue index 5ab7b8a..27c1838 100644 --- a/src/components/Editor/index.vue +++ b/src/components/Editor/index.vue @@ -1,14 +1,8 @@ @@ -18,9 +12,18 @@ import { reactive, shallowRef, watch, onBeforeUnmount, CSSProperties } from 'vue // @ts-ignore import { IDomEditor } from '@wangeditor/editor'; import { Toolbar, Editor } from '@wangeditor/editor-for-vue'; +import request from '/@/utils/request'; +import { useMessage } from '/@/hooks/message'; import { Session } from '/@/utils/storage'; import other from '/@/utils/other'; -const { proxy } = getCurrentInstance(); +type ImageInsertFn = (src: string) => void; +type VideoInsertFn = (src: string, poster: string) => void; + +const proxy = getCurrentInstance()?.proxy as { baseURL?: string } | null; +const baseURL = proxy?.baseURL || ''; +const message = useMessage(); +const VIDEO_MAX_SIZE = 10 * 1024 * 1024; +const VIDEO_MAX_SIZE_TEXT = '10MB'; // 定义父组件传过来的值 const props = defineProps({ @@ -71,13 +74,43 @@ const headers = computed(() => { }; }); -// 定义上传需要的字段信息 -const uploadAttr = reactive({ +// 定义图片上传需要的字段信息 +const uploadImageAttr = reactive({ fieldName: 'file', - server: proxy.baseURL + props.uploadFileUrl, + server: baseURL + props.uploadFileUrl, headers: headers, - customInsert(res, insertFn) { - insertFn(proxy.baseURL + res.data.url); + customInsert(res: any, insertFn: ImageInsertFn) { + insertFn(baseURL + res.data.url); + }, +}); + +// 定义视频上传需要的字段信息 +const uploadVideoAttr = reactive({ + fieldName: 'file', + server: baseURL + props.uploadFileUrl, + headers: headers, + maxFileSize: VIDEO_MAX_SIZE, + async customUpload(file: File, insertFn: VideoInsertFn) { + if (file.size > VIDEO_MAX_SIZE) { + message.warning(`上传视频大小不能超过 ${VIDEO_MAX_SIZE_TEXT}`); + return; + } + const formData = new FormData(); + formData.append('file', file); + try { + const res = await request({ + url: props.uploadFileUrl, + method: 'post', + headers: { + 'Content-Type': 'multipart/form-data', + 'Enc-Flag': 'false', + }, + data: formData, + }); + insertFn(baseURL + res.data.url, ''); + } catch (error: any) { + message.error(error?.msg || '视频上传失败'); + } }, }); @@ -86,8 +119,8 @@ const state = reactive({ editorConfig: { placeholder: props.placeholder, MENU_CONF: { - uploadImage: uploadAttr, - uploadVideo: uploadAttr, + uploadImage: uploadImageAttr, + uploadVideo: uploadVideoAttr, }, }, editorVal: props.getHtml, @@ -96,7 +129,7 @@ const state = reactive({ const styles = computed(() => ({ height: other.addUnit(props.height), width: other.addUnit(props.width), - 'z-index': 1000, + 'z-index': 1000, })); // 编辑器回调函数 @@ -114,18 +147,18 @@ const handleChange = (editor: IDomEditor) => { onBeforeUnmount(() => { const editor = editorRef.value; if (editor == null) return; - emit('update:getHtml', ''); - emit('update:getText', ''); - editor.destroy(); + emit('update:getHtml', ''); + emit('update:getText', ''); + editor.destroy(); }); // 监听是否禁用改变 -onMounted(() =>{ - nextTick(()=>{ - const editor = editorRef.value; - if (editor == null) return; - props.disable ? editor.disable() : editor.enable(); - }) +onMounted(() => { + nextTick(() => { + const editor = editorRef.value; + if (editor == null) return; + props.disable ? editor.disable() : editor.enable(); + }) }) // 监听双向绑定值改变,用于回显 diff --git a/src/views/car/carReignRecord/index.vue b/src/views/car/carReignRecord/index.vue new file mode 100644 index 0000000..654b401 --- /dev/null +++ b/src/views/car/carReignRecord/index.vue @@ -0,0 +1,194 @@ + + + \ No newline at end of file diff --git a/src/views/car/components/carTableDialog.vue b/src/views/car/components/carTableDialog.vue new file mode 100644 index 0000000..573543d --- /dev/null +++ b/src/views/car/components/carTableDialog.vue @@ -0,0 +1,173 @@ + + + + \ No newline at end of file diff --git a/src/views/door/components/doorTableDialog.vue b/src/views/door/components/doorTableDialog.vue index ecabd36..48a4480 100644 --- a/src/views/door/components/doorTableDialog.vue +++ b/src/views/door/components/doorTableDialog.vue @@ -35,17 +35,17 @@ :cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle"> + + + - - - + + + + + + + + + + + +