Merge remote-tracking branch 'origin/yagwly_fa_master' into yagwly_fa_master
| | |
| | | <template> |
| | | <basicContainer > |
| | | <avue-crud |
| | | :option="option" |
| | | :table-loading="pageF.loading" |
| | | :data="tableData" |
| | | :page="page" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | v-model="form" |
| | | ref="crudRef" |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | @refresh-change="refreshChange" |
| | | @row-del="rowDel" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @on-load="onLoad" |
| | | > |
| | | <basicContainer> |
| | | <avue-crud :option="option" :table-loading="pageF.loading" :data="tableData" :page="page" |
| | | :permission="permissionList" :before-open="beforeOpen" v-model="form" ref="crudRef" @row-update="rowUpdate" |
| | | @row-save="rowSave" @refresh-change="refreshChange" @row-del="rowDel" @search-change="searchChange" |
| | | @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange" |
| | | @size-change="sizeChange" @on-load="onLoad"> |
| | | <template #menu-left> |
| | | <el-button |
| | | type="success" |
| | | icon="Edit" |
| | | :disabled="pageF.single" |
| | | v-hasPermi="['cwgl:data:edit']" |
| | | @click="handleUpdate">修改 |
| | | <!-- <el-button type="success" icon="Edit" :disabled="pageF.single" v-hasPermi="['cwgl:data:edit']" |
| | | @click="handleUpdate">修改 |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | icon="Delete" |
| | | :disabled="pageF.multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['cwgl:data:remove']" |
| | | >删除 |
| | | </el-button> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="Download" |
| | | @click="handleExport" |
| | | v-hasPermi="['cwgl:data:export']" |
| | | >导出 |
| | | <el-button type="danger" icon="Delete" :disabled="pageF.multiple" @click="handleDelete" |
| | | v-hasPermi="['cwgl:data:remove']">删除 |
| | | </el-button> --> |
| | | <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['cwgl:data:export']">导出 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | |
| | | </template> |
| | | |
| | | <script setup name="data" lang="ts"> |
| | | import {DataI,addData, delData, exportData, getData, listData, updateData} from "@/api/cwgl/data"; |
| | | import useCurrentInstance from "@/utils/useCurrentInstance"; |
| | | import {computed,reactive, ref, toRefs} from "vue"; |
| | | import {PagesInterface, PageQueryInterface} from "@/utils/globalInterface"; |
| | | import {usePagePlus} from "@/hooks/usePagePlus"; |
| | | import {hasPermission} from "@/utils/permissionUtils"; |
| | | import { DataI, addData, delData, exportData, getData, listData, updateData } from "@/api/cwgl/data"; |
| | | import useCurrentInstance from "@/utils/useCurrentInstance"; |
| | | import { computed, reactive, ref, toRefs } from "vue"; |
| | | import { PagesInterface, PageQueryInterface } from "@/utils/globalInterface"; |
| | | import { usePagePlus } from "@/hooks/usePagePlus"; |
| | | import { hasPermission } from "@/utils/permissionUtils"; |
| | | |
| | | const { proxy } = useCurrentInstance(); |
| | | const crudRef = ref(); |
| | | const { proxy } = useCurrentInstance(); |
| | | const crudRef = ref(); |
| | | |
| | | const permissionList = computed(()=>{ |
| | | return { |
| | | addBtn: hasPermission(["cwgl:data:add"]), |
| | | delBtn: hasPermission(["cwgl:data:remove"]), |
| | | editBtn: hasPermission(["cwgl:data:edit"]), |
| | | viewBtn: hasPermission(["cwgl:data:query"]), |
| | | } |
| | | }) |
| | | const permissionList = computed(() => { |
| | | return { |
| | | addBtn: hasPermission(["cwgl:data:add"]), |
| | | delBtn: hasPermission(["cwgl:data:remove"]), |
| | | editBtn: hasPermission(["cwgl:data:edit"]), |
| | | viewBtn: hasPermission(["cwgl:data:query"]), |
| | | } |
| | | }) |
| | | |
| | | const data = reactive({ |
| | | form:<DataI>{}, |
| | | queryParams:<DataI&PageQueryInterface>{}, |
| | | page: <PagesInterface>{ |
| | | pageSize: 10, |
| | | total: 0, |
| | | currentPage: 1, |
| | | const data = reactive({ |
| | | form: <DataI>{}, |
| | | queryParams: <DataI & PageQueryInterface>{}, |
| | | page: <PagesInterface>{ |
| | | pageSize: 10, |
| | | total: 0, |
| | | currentPage: 1, |
| | | }, |
| | | selectionList: [], |
| | | }) |
| | | const { queryParams, form, page, selectionList } = toRefs(data); |
| | | const option = ref({ |
| | | pageKey: 'Data', |
| | | rowKey: 'id', |
| | | editDisplay: false, |
| | | addBtn: false, |
| | | editBtn: false, |
| | | menu: false, |
| | | delBtn: false, |
| | | viewBtn: false, |
| | | searchLabelWidth: 100, |
| | | labelWidth: 120, |
| | | column: { |
| | | // id: { |
| | | // label: '主键ID', |
| | | // }, |
| | | vin: { |
| | | label: '车架号', |
| | | minWidth: 200, |
| | | search: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "车架号不能为空", trigger: "blur" |
| | | } |
| | | ], |
| | | }, |
| | | selectionList:[], |
| | | }) |
| | | const {queryParams,form,page,selectionList} = toRefs(data); |
| | | const option = ref({ |
| | | pageKey: 'Data', |
| | | rowKey: 'id', |
| | | column: { |
| | | id: { |
| | | label: '主键ID', |
| | | }, |
| | | vin: { |
| | | label: '车架号', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "车架号不能为空", trigger: "blur" } |
| | | ], }, |
| | | chassisType: { |
| | | label: '底盘类型', |
| | | }, |
| | | eventDate: { |
| | | label: '数据日期', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "数据日期不能为空", trigger: "blur" } |
| | | ], }, |
| | | distance: { |
| | | label: '行驶里程', |
| | | }, |
| | | duration: { |
| | | label: '用车时长', |
| | | }, |
| | | shutdownDuration: { |
| | | label: '熄火停车时长', |
| | | }, |
| | | drivingDuration: { |
| | | label: '行驶时长', |
| | | }, |
| | | drivingDurationRatio: { |
| | | label: '行驶时长占比', |
| | | }, |
| | | idleDurationRatio: { |
| | | label: '怠速时长占比', |
| | | }, |
| | | idleDuration: { |
| | | label: '怠速时长', |
| | | }, |
| | | coastingDistanceRatio: { |
| | | label: '滑行距离占比', |
| | | }, |
| | | coastingDistance: { |
| | | label: '滑行距离', |
| | | }, |
| | | cruisingDistanceRatio: { |
| | | label: '巡航距离占比', |
| | | }, |
| | | cruisingDistance: { |
| | | label: '巡航距离', |
| | | }, |
| | | avgSpeed: { |
| | | label: '平均速度', |
| | | }, |
| | | avgDrivingSpeed: { |
| | | label: '平均行车速度', |
| | | }, |
| | | avgEngineSpeed: { |
| | | label: '发动机平均转速', |
| | | }, |
| | | economicEngineSpeedDurationRatio: { |
| | | label: '经济转速时长占比', |
| | | }, |
| | | economicEngineSpeedDuration: { |
| | | label: '经济转速时长', |
| | | }, |
| | | avgEnergyConsumption: { |
| | | label: '百公里能耗', |
| | | }, |
| | | energyConsumption: { |
| | | label: '耗油量', |
| | | }, |
| | | drivingEnergyConsumption: { |
| | | label: '行驶耗油量', |
| | | }, |
| | | drivingEnergyConsumptionRatio: { |
| | | label: '行驶耗油量占比', |
| | | }, |
| | | idleEnergyConsumptionRatio: { |
| | | label: '怠速耗油量占比', |
| | | }, |
| | | idleEnergyConsumption: { |
| | | label: '怠速耗油量', |
| | | }, |
| | | avgAdblueConsumption: { |
| | | label: '百公里尿素消耗', |
| | | }, |
| | | adblueConsumption: { |
| | | label: '尿素消耗', |
| | | }, |
| | | avgGrossWeight: { |
| | | label: '平均整车质量', |
| | | }, |
| | | brakeTimes: { |
| | | label: '刹车次数', |
| | | }, |
| | | harshBrakeTimes: { |
| | | label: '急刹车次数', |
| | | }, |
| | | accelerationTimes: { |
| | | label: '急加速次数', |
| | | }, |
| | | avgBrakeTimes: { |
| | | label: '百公里刹车次数', |
| | | }, |
| | | avgHarshBrakeTimes: { |
| | | label: '百公里急刹车次数', |
| | | }, |
| | | avgAccelerationTimes: { |
| | | label: '百公里急加速次数', |
| | | }, |
| | | odometer: { |
| | | label: '里程表里程', |
| | | }, |
| | | createTime: { |
| | | label: '创建时间', |
| | | }, |
| | | updateTime: { |
| | | label: '更新时间', |
| | | }, |
| | | } |
| | | }) |
| | | chassisType: { |
| | | label: '底盘类型', |
| | | minWidth: 200, |
| | | }, |
| | | eventDate: { |
| | | label: '数据日期', |
| | | minWidth: 200, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "数据日期不能为空", trigger: "blur" |
| | | } |
| | | ], |
| | | }, |
| | | distance: { |
| | | label: '行驶里程', |
| | | minWidth: 150, |
| | | }, |
| | | duration: { |
| | | label: '用车时长', |
| | | minWidth: 100, |
| | | }, |
| | | shutdownDuration: { |
| | | label: '熄火停车时长', |
| | | minWidth: 120, |
| | | }, |
| | | drivingDuration: { |
| | | label: '行驶时长', |
| | | minWidth: 100, |
| | | }, |
| | | drivingDurationRatio: { |
| | | label: '行驶时长占比', |
| | | minWidth: 120, |
| | | }, |
| | | idleDurationRatio: { |
| | | label: '怠速时长占比', |
| | | minWidth: 120, |
| | | }, |
| | | idleDuration: { |
| | | label: '怠速时长', |
| | | minWidth: 100, |
| | | }, |
| | | coastingDistanceRatio: { |
| | | label: '滑行距离占比', |
| | | minWidth: 120, |
| | | }, |
| | | coastingDistance: { |
| | | label: '滑行距离', |
| | | minWidth: 100, |
| | | }, |
| | | cruisingDistanceRatio: { |
| | | label: '巡航距离占比', |
| | | minWidth: 120, |
| | | }, |
| | | cruisingDistance: { |
| | | label: '巡航距离', |
| | | minWidth: 100, |
| | | }, |
| | | avgSpeed: { |
| | | label: '平均速度', |
| | | minWidth: 100, |
| | | }, |
| | | avgDrivingSpeed: { |
| | | label: '平均行车速度', |
| | | minWidth: 120, |
| | | }, |
| | | avgEngineSpeed: { |
| | | label: '发动机平均转速', |
| | | minWidth: 120, |
| | | }, |
| | | economicEngineSpeedDurationRatio: { |
| | | label: '经济转速时长占比', |
| | | minWidth: 150, |
| | | }, |
| | | economicEngineSpeedDuration: { |
| | | label: '经济转速时长', |
| | | minWidth: 120, |
| | | }, |
| | | avgEnergyConsumption: { |
| | | label: '百公里能耗', |
| | | minWidth: 100, |
| | | }, |
| | | energyConsumption: { |
| | | label: '耗油量', |
| | | }, |
| | | drivingEnergyConsumption: { |
| | | label: '行驶耗油量', |
| | | minWidth: 100, |
| | | }, |
| | | drivingEnergyConsumptionRatio: { |
| | | label: '行驶耗油量占比', |
| | | minWidth: 150, |
| | | }, |
| | | idleEnergyConsumptionRatio: { |
| | | label: '怠速耗油量占比', |
| | | minWidth: 150, |
| | | }, |
| | | idleEnergyConsumption: { |
| | | label: '怠速耗油量', |
| | | minWidth: 100, |
| | | }, |
| | | avgAdblueConsumption: { |
| | | label: '百公里尿素消耗', |
| | | minWidth: 150, |
| | | }, |
| | | adblueConsumption: { |
| | | label: '尿素消耗', |
| | | minWidth: 100, |
| | | }, |
| | | avgGrossWeight: { |
| | | label: '平均整车质量', |
| | | minWidth: 120, |
| | | }, |
| | | brakeTimes: { |
| | | label: '刹车次数', |
| | | minWidth: 100, |
| | | }, |
| | | harshBrakeTimes: { |
| | | label: '急刹车次数', |
| | | minWidth: 100, |
| | | }, |
| | | accelerationTimes: { |
| | | label: '急加速次数', |
| | | minWidth: 100, |
| | | }, |
| | | avgBrakeTimes: { |
| | | label: '百公里刹车次数', |
| | | minWidth: 120, |
| | | }, |
| | | avgHarshBrakeTimes: { |
| | | label: '百公里急刹车次数', |
| | | minWidth: 140, |
| | | |
| | | const { tableData,pageF,rowSave,rowUpdate,rowDel,beforeOpen,searchChange, |
| | | searchReset,selectionChange,onLoad,currentChange,sizeChange,handleDelete,handleExport,handleUpdate,refreshChange} = usePagePlus({ |
| | | form:form, |
| | | option:option, |
| | | queryParams:queryParams, |
| | | idKey:'id', |
| | | page:page.value, |
| | | getListApi:listData, |
| | | getDetailApi:getData, |
| | | exportApi:exportData, |
| | | deleteApi:delData, |
| | | addApi:addData, |
| | | updateApi:updateData, |
| | | handleUpdateFunc:()=>{ |
| | | }, |
| | | avgAccelerationTimes: { |
| | | label: '百公里急加速次数', |
| | | minWidth: 140, |
| | | |
| | | }, |
| | | odometer: { |
| | | label: '里程表里程', |
| | | minWidth: 120, |
| | | |
| | | }, |
| | | createTime: { |
| | | label: '创建时间', |
| | | minWidth: 180, |
| | | |
| | | }, |
| | | updateTime: { |
| | | label: '更新时间', |
| | | minWidth: 180, |
| | | |
| | | }, |
| | | } |
| | | }) |
| | | |
| | | const { tableData, pageF, rowSave, rowUpdate, rowDel, beforeOpen, searchChange, |
| | | searchReset, selectionChange, onLoad, currentChange, sizeChange, handleDelete, handleExport, handleUpdate, refreshChange } = usePagePlus({ |
| | | form: form, |
| | | option: option, |
| | | queryParams: queryParams, |
| | | idKey: 'id', |
| | | page: page.value, |
| | | getListApi: listData, |
| | | getDetailApi: getData, |
| | | exportApi: exportData, |
| | | deleteApi: delData, |
| | | addApi: addData, |
| | | updateApi: updateData, |
| | | handleUpdateFunc: () => { |
| | | crudRef.value.rowEdit(selectionList.value[0]); |
| | | }, |
| | | handleSelectionChangeFunc:(selection:any)=>{ |
| | | handleSelectionChangeFunc: (selection: any) => { |
| | | selectionList.value = selection; |
| | | } |
| | | }) |