|
|
@@ -15,20 +15,24 @@
|
|
|
</el-form-item>
|
|
|
<!-- TODO @李伟 -->
|
|
|
<el-form-item label="业务类型" prop="ext1">
|
|
|
- <el-input v-model="queryParams.ext1" placeholder="请输入业务类型" clearable style="width: 160px"
|
|
|
- @keyup.enter="handleQuery" />
|
|
|
+ <el-select v-model="queryParams.params.ext1$bussinessType" filterable clearable placeholder="业务分类">
|
|
|
+ <el-option v-for="item in bussinessTypeList" :key="item.dictValue" :label="item.dictLabel"
|
|
|
+ :value="item.dictValue" />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
<!-- TODO @李伟 -->
|
|
|
<el-form-item label="能耗类型" prop="ext1">
|
|
|
- <el-input v-model="queryParams.ext1" placeholder="请输入能耗类型" clearable style="width: 160px"
|
|
|
- @keyup.enter="handleQuery" />
|
|
|
+ <el-select v-model="queryParams.params.ext1$energyType" filterable clearable placeholder="能耗分类">
|
|
|
+ <el-option v-for="item in energyTypeList" :key="item.dictValue" :label="item.dictLabel"
|
|
|
+ :value="item.dictValue" />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="网格" prop="wangge">
|
|
|
- <el-input v-model="queryParams.wangge" placeholder="请输入网格" clearable style="width: 160px"
|
|
|
+ <el-input v-model="queryParams.params.ext1$wangge" placeholder="请输入网格" clearable style="width: 160px"
|
|
|
@keyup.enter="handleQuery" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="单位" prop="dept">
|
|
|
- <el-input v-model="queryParams.dept" placeholder="请输入单位" clearable style="width: 160px"
|
|
|
+ <el-input v-model="queryParams.params.ext1$dept" placeholder="请输入单位" clearable style="width: 160px"
|
|
|
@keyup.enter="handleQuery" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -36,7 +40,8 @@
|
|
|
<div style="width: 15%;">
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="goadd">新增</el-button>
|
|
|
- <el-button type="primary" @click="resetQuery">查询</el-button>
|
|
|
+ <el-button type="primary" @click="handleQuery">查询</el-button>
|
|
|
+ <!-- <el-button type="primary" @click="resetQuery">重置</el-button> -->
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -67,9 +72,8 @@
|
|
|
<el-dialog v-if="dialog.visible" :title="dialog.title" v-model="dialog.visible" width="40vw" append-to-body>
|
|
|
<el-form :inline="true" label-width="68px">
|
|
|
<el-form-item label="时间选择" prop="carNum">
|
|
|
- <el-date-picker v-model="timeArry" type="datetimerange" start-placeholder="开始时间"
|
|
|
- end-placeholder="结束时间" format="YYYY-MM-DD HH:mm:ss" date-format="YYYY/MM/DD ddd"
|
|
|
- time-format="HH:mm:ss" style="width: 20vw;"/>
|
|
|
+ <el-date-picker v-model="timeArry" type="datetimerange" start-placeholder="开始时间" end-placeholder="结束时间"
|
|
|
+ format="YYYY-MM-DD HH:mm:ss" date-format="YYYY/MM/DD ddd" time-format="HH:mm:ss" style="width: 20vw;" />
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="carNum">
|
|
|
<el-button type="primary" @click="initMapLine">查询</el-button>
|
|
|
@@ -82,102 +86,89 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup name="CarInfo" lang="ts">
|
|
|
-import { listCarInfo, getCarInfo, delCarInfo, addCarInfo, updateCarInfo } from '@/api/carInfo';
|
|
|
-import { CarInfoVO, CarInfoQuery, CarInfoForm } from '@/api/carInfo/types';
|
|
|
-import tableElm from "@/components/Public/table.vue";
|
|
|
-import { useRoute, useRouter } from "vue-router";
|
|
|
-import useTagsViewStore from '@/store/modules/tagsView';
|
|
|
-import { h } from 'vue';
|
|
|
-import { ElButton, ElMessage } from 'element-plus'
|
|
|
-import mapDiv from "@/components/Map/index.vue"
|
|
|
-import moment from 'moment';
|
|
|
-
|
|
|
-
|
|
|
-const route = useRoute();
|
|
|
-const router = useRouter();
|
|
|
-
|
|
|
-const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
-
|
|
|
-const carInfoList = ref<CarInfoVO[]>([]);
|
|
|
-const buttonLoading = ref(false);
|
|
|
-const loading = ref(true);
|
|
|
-const showSearch = ref(true);
|
|
|
-const ids = ref<Array<string | number>>([]);
|
|
|
-const single = ref(true);
|
|
|
-const multiple = ref(true);
|
|
|
-const total = ref(0);
|
|
|
-
|
|
|
-const showMarket = ref(false)
|
|
|
-
|
|
|
-const timeArry = ref([])
|
|
|
-
|
|
|
-const queryFormRef = ref<ElFormInstance>();
|
|
|
-const carInfoFormRef = ref<ElFormInstance>();
|
|
|
-
|
|
|
-const dialog = reactive<DialogOption>({
|
|
|
- visible: false,
|
|
|
- title: ''
|
|
|
-});
|
|
|
-
|
|
|
-const table = ref(tableElm)
|
|
|
-
|
|
|
-const columns = ref([
|
|
|
- // {label: '上层位置', prop: 'v', visible: true},
|
|
|
- { label: '车牌号', prop: 'carNum', visible: true, isTemplate: false },
|
|
|
- { label: '能源类型、业务类型', prop: 'ext1', visible: true, isTemplate: false, isTemplateTag: true },
|
|
|
- { label: '车辆分类', prop: 'carType', pprop: "ext1", visible: true, isTemplate: false, isTemplateJson: false, dict: "tbl_car_type" },
|
|
|
- { label: '网格', prop: 'wangge', pprop: "ext1", visible: true, isTemplate: false, isTemplateJson: true },
|
|
|
- { label: '单位', prop: 'dept', pprop: "ext1", visible: true, isTemplate: false, isTemplateJson: true },
|
|
|
- {
|
|
|
- label: '操作', custom: true, visible: true, render: (data) => {
|
|
|
-
|
|
|
- return h('div', [h(ElButton, {
|
|
|
- type: 'primary', // 组件属性
|
|
|
- link: true,
|
|
|
- onClick: () => {
|
|
|
- handleUpdate(data)
|
|
|
- },
|
|
|
- }, '管理'), h(ElButton, {
|
|
|
- type: 'danger', // 组件属性
|
|
|
- link: true,
|
|
|
- onClick: () => {
|
|
|
- handleDelete(data)
|
|
|
- },
|
|
|
- }, '删除')].concat([h(ElButton, {
|
|
|
- type: 'primary', // 组件属性
|
|
|
- link: true,
|
|
|
- onClick: () => {
|
|
|
- openMapDiv(data)
|
|
|
- },
|
|
|
- }, '轨迹查询')]));
|
|
|
- }
|
|
|
- },
|
|
|
-])
|
|
|
-
|
|
|
-const mapElm = ref(mapDiv)
|
|
|
-
|
|
|
-const catObj = ref('');
|
|
|
-
|
|
|
-const initFormData: CarInfoForm = {
|
|
|
- id: undefined,
|
|
|
- carNum: undefined,
|
|
|
- carType: undefined,
|
|
|
- deviceInfos: undefined,
|
|
|
- repairInfo: undefined,
|
|
|
- maintenanceInfo: undefined,
|
|
|
- insuranceInfo: undefined,
|
|
|
- inspectionInfo: undefined,
|
|
|
- trafficAccidentInfo: undefined,
|
|
|
- violationInfo: undefined,
|
|
|
- changeInfo: undefined,
|
|
|
- ext1: undefined,
|
|
|
- ext2: undefined
|
|
|
-}
|
|
|
-const data = reactive<PageData<CarInfoForm, CarInfoQuery>>({
|
|
|
- form: { ...initFormData },
|
|
|
- queryParams: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
+ import { listCarInfo, getCarInfo, delCarInfo, addCarInfo, updateCarInfo } from '@/api/carInfo';
|
|
|
+ import { CarInfoVO, CarInfoQuery, CarInfoForm } from '@/api/carInfo/types';
|
|
|
+ import tableElm from "@/components/Public/table.vue";
|
|
|
+ import { useRoute, useRouter } from "vue-router";
|
|
|
+ import { getDicts } from '@/api/system/dict/data'
|
|
|
+ import useTagsViewStore from '@/store/modules/tagsView';
|
|
|
+ import { h } from 'vue';
|
|
|
+ import { ElButton, ElMessage } from 'element-plus'
|
|
|
+ import mapDiv from "@/components/Map/index.vue"
|
|
|
+ import moment from 'moment';
|
|
|
+
|
|
|
+
|
|
|
+ const route = useRoute();
|
|
|
+ const router = useRouter();
|
|
|
+
|
|
|
+ const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
+
|
|
|
+ const carInfoList = ref < CarInfoVO[] > ([]);
|
|
|
+ const buttonLoading = ref(false);
|
|
|
+ const loading = ref(true);
|
|
|
+ const showSearch = ref(true);
|
|
|
+ const ids = ref < Array < string | number >> ([]);
|
|
|
+ const single = ref(true);
|
|
|
+ const multiple = ref(true);
|
|
|
+ const total = ref(0);
|
|
|
+ const params = ref(null)
|
|
|
+
|
|
|
+ const showMarket = ref(false)
|
|
|
+
|
|
|
+ const timeArry = ref([])
|
|
|
+
|
|
|
+ const queryFormRef = ref < ElFormInstance > ();
|
|
|
+ const carInfoFormRef = ref < ElFormInstance > ();
|
|
|
+
|
|
|
+ const dialog = reactive < DialogOption > ({
|
|
|
+ visible: false,
|
|
|
+ title: ''
|
|
|
+ });
|
|
|
+
|
|
|
+ const table = ref(tableElm)
|
|
|
+
|
|
|
+ const columns = ref([
|
|
|
+ // {label: '上层位置', prop: 'v', visible: true},
|
|
|
+ { label: '车牌号', prop: 'carNum', visible: true, isTemplate: false },
|
|
|
+ { label: '能源类型、业务类型', prop: 'ext1', visible: true, isTemplate: false, isTemplateTag: true },
|
|
|
+ { label: '车辆分类', prop: 'carType', pprop: "ext1", visible: true, isTemplate: false, isTemplateJson: false, dict: "tbl_car_type" },
|
|
|
+ { label: '网格', prop: 'wangge', pprop: "ext1", visible: true, isTemplate: false, isTemplateJson: true },
|
|
|
+ { label: '单位', prop: 'dept', pprop: "ext1", visible: true, isTemplate: false, isTemplateJson: true },
|
|
|
+ {
|
|
|
+ label: '操作', custom: true, visible: true, render: (data) => {
|
|
|
+
|
|
|
+ return h('div', [h(ElButton, {
|
|
|
+ type: 'primary', // 组件属性
|
|
|
+ link: true,
|
|
|
+ onClick: () => {
|
|
|
+ handleUpdate(data)
|
|
|
+ },
|
|
|
+ }, '管理'), h(ElButton, {
|
|
|
+ type: 'danger', // 组件属性
|
|
|
+ link: true,
|
|
|
+ onClick: () => {
|
|
|
+ handleDelete(data)
|
|
|
+ },
|
|
|
+ }, '删除')].concat([h(ElButton, {
|
|
|
+ type: 'primary', // 组件属性
|
|
|
+ link: true,
|
|
|
+ onClick: () => {
|
|
|
+ openMapDiv(data)
|
|
|
+ },
|
|
|
+ }, '轨迹查询')]));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ])
|
|
|
+
|
|
|
+ const mapElm = ref(mapDiv)
|
|
|
+
|
|
|
+ const energyTypeList = ref([])
|
|
|
+ const bussinessTypeList =ref([])
|
|
|
+
|
|
|
+ const catObj = ref('');
|
|
|
+
|
|
|
+ const initFormData: CarInfoForm = {
|
|
|
+ id: undefined,
|
|
|
carNum: undefined,
|
|
|
carType: undefined,
|
|
|
deviceInfos: undefined,
|
|
|
@@ -189,203 +180,236 @@ const data = reactive<PageData<CarInfoForm, CarInfoQuery>>({
|
|
|
violationInfo: undefined,
|
|
|
changeInfo: undefined,
|
|
|
ext1: undefined,
|
|
|
- ext2: undefined,
|
|
|
- params: {
|
|
|
- }
|
|
|
- },
|
|
|
- rules: {
|
|
|
- id: [
|
|
|
- { required: true, message: "编号不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- carNum: [
|
|
|
- { required: true, message: "车牌号不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- carType: [
|
|
|
- { required: true, message: "车类型不能为空", trigger: "change" }
|
|
|
- ],
|
|
|
- deviceInfos: [
|
|
|
- { required: true, message: "所有车载设备信息不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- repairInfo: [
|
|
|
- { required: true, message: "维修信息不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- maintenanceInfo: [
|
|
|
- { required: true, message: "保养信息不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- insuranceInfo: [
|
|
|
- { required: true, message: "保险信息不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- inspectionInfo: [
|
|
|
- { required: true, message: "年检信息不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- trafficAccidentInfo: [
|
|
|
- { required: true, message: "交通事故信息不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- violationInfo: [
|
|
|
- { required: true, message: "违章信息不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- changeInfo: [
|
|
|
- { required: true, message: "车辆变更信息不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- ext1: [
|
|
|
- { required: true, message: "扩展1不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- ext2: [
|
|
|
- { required: true, message: "扩展2不能为空", trigger: "blur" }
|
|
|
- ]
|
|
|
+ ext2: undefined
|
|
|
}
|
|
|
-});
|
|
|
-
|
|
|
-const { queryParams, form, rules } = toRefs(data);
|
|
|
-
|
|
|
-const goadd = () => {
|
|
|
- useTagsViewStore().delView(route);
|
|
|
- // 跳转路由
|
|
|
- router.push({ path: "/car/carInfo/add" });
|
|
|
- // router.push("/car/carInfo/add")
|
|
|
-}
|
|
|
-
|
|
|
-const initMapLine = () => {
|
|
|
- const info = catObj.value
|
|
|
- // const info = getCatInfoData(data.carNum);
|
|
|
- console.log(timeArry.value)
|
|
|
- var deviceInfo = JSON.parse(info.deviceInfos)
|
|
|
- console.log(deviceInfo)
|
|
|
- var code = '';
|
|
|
- for (var index in deviceInfo) {
|
|
|
- if (deviceInfo[index].type == 'gps') {
|
|
|
- code = deviceInfo[index].code
|
|
|
+ const data = reactive < PageData < CarInfoForm, CarInfoQuery>> ({
|
|
|
+ form: { ...initFormData },
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ carNum: undefined,
|
|
|
+ carType: undefined,
|
|
|
+ deviceInfos: undefined,
|
|
|
+ repairInfo: undefined,
|
|
|
+ maintenanceInfo: undefined,
|
|
|
+ insuranceInfo: undefined,
|
|
|
+ inspectionInfo: undefined,
|
|
|
+ trafficAccidentInfo: undefined,
|
|
|
+ violationInfo: undefined,
|
|
|
+ changeInfo: undefined,
|
|
|
+ ext1: undefined,
|
|
|
+ ext2: undefined,
|
|
|
+ params: {
|
|
|
+ ext1$energyType: undefined,
|
|
|
+ ext2$bussinessType: undefined
|
|
|
+ }
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ id: [
|
|
|
+ { required: true, message: "编号不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ carNum: [
|
|
|
+ { required: true, message: "车牌号不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ carType: [
|
|
|
+ { required: true, message: "车类型不能为空", trigger: "change" }
|
|
|
+ ],
|
|
|
+ deviceInfos: [
|
|
|
+ { required: true, message: "所有车载设备信息不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ repairInfo: [
|
|
|
+ { required: true, message: "维修信息不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ maintenanceInfo: [
|
|
|
+ { required: true, message: "保养信息不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ insuranceInfo: [
|
|
|
+ { required: true, message: "保险信息不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ inspectionInfo: [
|
|
|
+ { required: true, message: "年检信息不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ trafficAccidentInfo: [
|
|
|
+ { required: true, message: "交通事故信息不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ violationInfo: [
|
|
|
+ { required: true, message: "违章信息不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ changeInfo: [
|
|
|
+ { required: true, message: "车辆变更信息不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ ext1: [
|
|
|
+ { required: true, message: "扩展1不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ ext2: [
|
|
|
+ { required: true, message: "扩展2不能为空", trigger: "blur" }
|
|
|
+ ]
|
|
|
}
|
|
|
+ });
|
|
|
+
|
|
|
+ const { queryParams, form, rules } = toRefs(data);
|
|
|
+
|
|
|
+ const goadd = () => {
|
|
|
+ useTagsViewStore().delView(route);
|
|
|
+ // 跳转路由
|
|
|
+ router.push({ path: "/car/carInfo/add" });
|
|
|
+ // router.push("/car/carInfo/add")
|
|
|
}
|
|
|
- // var date = moment(new Date()).format('YYYY-MM-DD')
|
|
|
- var param = {
|
|
|
- devicecode: code,
|
|
|
- params: {
|
|
|
- starttime: moment(timeArry.value[0]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- endtime: moment(timeArry.value[1]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+
|
|
|
+ const initMapLine = () => {
|
|
|
+ const info = catObj.value
|
|
|
+ // const info = getCatInfoData(data.carNum);
|
|
|
+ console.log(timeArry.value)
|
|
|
+ var deviceInfo = JSON.parse(info.deviceInfos)
|
|
|
+ console.log(deviceInfo)
|
|
|
+ var code = '';
|
|
|
+ for (var index in deviceInfo) {
|
|
|
+ if (deviceInfo[index].type == 'gps') {
|
|
|
+ code = deviceInfo[index].code
|
|
|
+ }
|
|
|
}
|
|
|
+ // var date = moment(new Date()).format('YYYY-MM-DD')
|
|
|
+ var param = {
|
|
|
+ devicecode: code,
|
|
|
+ params: {
|
|
|
+ starttime: moment(timeArry.value[0]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ endtime: moment(timeArry.value[1]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // console.log(mapElm.value);
|
|
|
+ // mapElm.value.getGpsDataList(param);
|
|
|
+ // setTimeout(() => {
|
|
|
+ mapElm.value.getGpsDataList(param);
|
|
|
+ // }, 1000);
|
|
|
}
|
|
|
- // console.log(mapElm.value);
|
|
|
- // mapElm.value.getGpsDataList(param);
|
|
|
- // setTimeout(() => {
|
|
|
- mapElm.value.getGpsDataList(param);
|
|
|
- // }, 1000);
|
|
|
-}
|
|
|
-
|
|
|
-const openMapDiv = (data) => {
|
|
|
- dialog.visible = true;
|
|
|
- catObj.value = data;
|
|
|
- timeArry.value[0] = new Date(new Date().getTime() - 60*60*24*1000);
|
|
|
- timeArry.value[1] = new Date(new Date().getTime());
|
|
|
- setTimeout(() => {
|
|
|
- initMapLine();
|
|
|
- }, 1000);
|
|
|
-}
|
|
|
-
|
|
|
-/** 查询车辆信息列表 */
|
|
|
-const getList = async () => {
|
|
|
- loading.value = true;
|
|
|
- const res = await listCarInfo(queryParams.value);
|
|
|
- table.value.setDataList(res.rows);
|
|
|
- total.value = res.total;
|
|
|
- loading.value = false;
|
|
|
-}
|
|
|
-
|
|
|
-/** 取消按钮 */
|
|
|
-const cancel = () => {
|
|
|
- reset();
|
|
|
- dialog.visible = false;
|
|
|
-}
|
|
|
-
|
|
|
-/** 表单重置 */
|
|
|
-const reset = () => {
|
|
|
- form.value = { ...initFormData };
|
|
|
- carInfoFormRef.value?.resetFields();
|
|
|
-}
|
|
|
-
|
|
|
-/** 搜索按钮操作 */
|
|
|
-const handleQuery = () => {
|
|
|
- queryParams.value.pageNum = 1;
|
|
|
- getList();
|
|
|
-}
|
|
|
-
|
|
|
-/** 重置按钮操作 */
|
|
|
-const resetQuery = () => {
|
|
|
- queryFormRef.value?.resetFields();
|
|
|
- handleQuery();
|
|
|
-}
|
|
|
-
|
|
|
-/** 多选框选中数据 */
|
|
|
-const handleSelectionChange = (selection: CarInfoVO[]) => {
|
|
|
- ids.value = selection.map(item => item.id);
|
|
|
- single.value = selection.length != 1;
|
|
|
- multiple.value = !selection.length;
|
|
|
-}
|
|
|
-
|
|
|
-/** 新增按钮操作 */
|
|
|
-const handleAdd = () => {
|
|
|
- reset();
|
|
|
- dialog.visible = true;
|
|
|
- dialog.title = "添加车辆信息";
|
|
|
-}
|
|
|
-
|
|
|
-/** 修改按钮操作 */
|
|
|
-const handleUpdate = async (row?: CarInfoVO) => {
|
|
|
- useTagsViewStore().delView(route);
|
|
|
- router.push({ path: '/car/carInfo/update', query: { id: row.id } })
|
|
|
-}
|
|
|
-
|
|
|
-/** 提交按钮 */
|
|
|
-const submitForm = () => {
|
|
|
- carInfoFormRef.value?.validate(async (valid: boolean) => {
|
|
|
- if (valid) {
|
|
|
- buttonLoading.value = true;
|
|
|
- if (form.value.id) {
|
|
|
- await updateCarInfo(form.value).finally(() => buttonLoading.value = false);
|
|
|
- } else {
|
|
|
- await addCarInfo(form.value).finally(() => buttonLoading.value = false);
|
|
|
+
|
|
|
+ const openMapDiv = (data) => {
|
|
|
+ dialog.visible = true;
|
|
|
+ catObj.value = data;
|
|
|
+ timeArry.value[0] = new Date(new Date().getTime() - 60 * 60 * 24 * 1000);
|
|
|
+ timeArry.value[1] = new Date(new Date().getTime());
|
|
|
+ setTimeout(() => {
|
|
|
+ initMapLine();
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 查询车辆信息列表 */
|
|
|
+ const getList = async () => {
|
|
|
+ loading.value = true;
|
|
|
+ console.log(queryParams.value)
|
|
|
+ const res = await listCarInfo(queryParams.value);
|
|
|
+ table.value.setDataList(res.rows);
|
|
|
+ total.value = res.total;
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 取消按钮 */
|
|
|
+ const cancel = () => {
|
|
|
+ reset();
|
|
|
+ dialog.visible = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 表单重置 */
|
|
|
+ const reset = () => {
|
|
|
+ form.value = { ...initFormData };
|
|
|
+ carInfoFormRef.value?.resetFields();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ const handleQuery = () => {
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
+ getList();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ const resetQuery = () => {
|
|
|
+ queryFormRef.value?.resetFields();
|
|
|
+ handleQuery();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 多选框选中数据 */
|
|
|
+ const handleSelectionChange = (selection: CarInfoVO[]) => {
|
|
|
+ ids.value = selection.map(item => item.id);
|
|
|
+ single.value = selection.length != 1;
|
|
|
+ multiple.value = !selection.length;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ const handleAdd = () => {
|
|
|
+ reset();
|
|
|
+ dialog.visible = true;
|
|
|
+ dialog.title = "添加车辆信息";
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ const handleUpdate = async (row?: CarInfoVO) => {
|
|
|
+ useTagsViewStore().delView(route);
|
|
|
+ router.push({ path: '/car/carInfo/update', query: { id: row.id } })
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 提交按钮 */
|
|
|
+ const submitForm = () => {
|
|
|
+ carInfoFormRef.value?.validate(async (valid: boolean) => {
|
|
|
+ if (valid) {
|
|
|
+ buttonLoading.value = true;
|
|
|
+ if (form.value.id) {
|
|
|
+ await updateCarInfo(form.value).finally(() => buttonLoading.value = false);
|
|
|
+ } else {
|
|
|
+ await addCarInfo(form.value).finally(() => buttonLoading.value = false);
|
|
|
+ }
|
|
|
+ proxy?.$modal.msgSuccess("修改成功");
|
|
|
+ dialog.visible = false;
|
|
|
+ await getList();
|
|
|
}
|
|
|
- proxy?.$modal.msgSuccess("修改成功");
|
|
|
- dialog.visible = false;
|
|
|
- await getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ const handleDelete = async (row?: CarInfoVO) => {
|
|
|
+ const _ids = row?.id || ids.value;
|
|
|
+ await proxy?.$modal.confirm('是否确认删除车辆信息编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
|
|
+ await delCarInfo(_ids);
|
|
|
+ proxy?.$modal.msgSuccess("删除成功");
|
|
|
+ await getList();
|
|
|
+ }
|
|
|
+
|
|
|
+ const childrenClick = (data) => {
|
|
|
+ if (data.func == "handleUpdate") {
|
|
|
+ handleUpdate(data.data)
|
|
|
+ } else if (data.func == "handleDelete") {
|
|
|
+ handleDelete(data.data)
|
|
|
}
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-/** 删除按钮操作 */
|
|
|
-const handleDelete = async (row?: CarInfoVO) => {
|
|
|
- const _ids = row?.id || ids.value;
|
|
|
- await proxy?.$modal.confirm('是否确认删除车辆信息编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
|
|
- await delCarInfo(_ids);
|
|
|
- proxy?.$modal.msgSuccess("删除成功");
|
|
|
- await getList();
|
|
|
-}
|
|
|
-
|
|
|
-const childrenClick = (data) => {
|
|
|
- if (data.func == "handleUpdate") {
|
|
|
- handleUpdate(data.data)
|
|
|
- } else if (data.func == "handleDelete") {
|
|
|
- handleDelete(data.data)
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-/** 导出按钮操作 */
|
|
|
-const handleExport = () => {
|
|
|
- proxy?.download('system/carInfo/export', {
|
|
|
- ...queryParams.value
|
|
|
- }, `carInfo_${new Date().getTime()}.xlsx`)
|
|
|
-}
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ const handleExport = () => {
|
|
|
+ proxy?.download('system/carInfo/export', {
|
|
|
+ ...queryParams.value
|
|
|
+ }, `carInfo_${new Date().getTime()}.xlsx`)
|
|
|
+ }
|
|
|
+
|
|
|
+ // const childrenClick = (data) => {
|
|
|
+ // eval(data.func + "(data.data)")
|
|
|
+ // }
|
|
|
+
|
|
|
+ const initData = async () => {
|
|
|
+ await getDictsData('energy_type', energyTypeList);
|
|
|
+ await getDictsData('business_type', bussinessTypeList);
|
|
|
+ }
|
|
|
|
|
|
-// const childrenClick = (data) => {
|
|
|
-// eval(data.func + "(data.data)")
|
|
|
-// }
|
|
|
+ const getDictsData = (param, obj) => {
|
|
|
+ getDicts(param).then(res => {
|
|
|
+ obj.value = res.data;
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
-getList();
|
|
|
+ getList();
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- // initMapLine();
|
|
|
- // getList();
|
|
|
-});
|
|
|
+ onMounted(() => {
|
|
|
+ initData();
|
|
|
+ // initMapLine();
|
|
|
+ // getList();
|
|
|
+ });
|
|
|
|
|
|
|
|
|
-</script>
|
|
|
+</script>
|