Просмотр исходного кода

Merge branch 'master' of http://git.xt.wenhq.top:8083/wenhongquan/khyznh-ui

liwei19941102 1 год назад
Родитель
Сommit
c29e54b1e4

+ 1 - 1
src/components/HomeComponents/warnTable.vue

@@ -46,7 +46,7 @@ const getList = () => {
     })
     //排序
     msg = msg.sort((a, b) => {
-      return moment(a.time).unix() - moment(b.time).unix();
+      return moment(b.time).unix() - moment(a.time).unix();
     })
     messageList.value = msg;
 

+ 1 - 1
src/components/HomeStatics/warnTable.vue

@@ -39,7 +39,7 @@ const getList = () => {
     })
     //排序
     msg = msg.sort((a, b) => {
-      return moment(a.time).unix() - moment(b.time).unix();
+      return moment(b.time).unix() - moment(a.time).unix();
     })
     messageList.value = msg;
 

+ 1 - 1
src/components/Public/table.vue

@@ -52,7 +52,7 @@
 
 <script setup lang="ts">
 const { proxy } = getCurrentInstance() as ComponentInternalInstance
-const { energy_type, business_type,tbl_car_type } = toRefs<any>(proxy?.useDict("energy_type", "business_type","tbl_car_type"));
+const { energy_type, business_type, tbl_car_type } = toRefs<any>(proxy?.useDict("energy_type", "business_type", "tbl_car_type"));
 
 const route = useRoute();
 const router = useRouter();

+ 58 - 19
src/views/car/work/carWork.vue

@@ -1,21 +1,24 @@
 <template>
   <div class="p-2">
-    <transition :enter-active-class="proxy?.animate.searchAnimate.enter"
-      :leave-active-class="proxy?.animate.searchAnimate.leave">
+    <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
       <div class="search" v-show="showSearch" style="display: flex;flex-direction: row;">
         <div style="width: 85%;">
           <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
             <el-form-item label="车牌号" prop="carNum">
-              <el-input v-model="queryParams.carNum" placeholder="请输入车牌号" clearable style="width: 160px"
-                @keyup.enter="handleQuery" />
+              <el-input v-model="queryParams.carNum" placeholder="请输入车牌号" clearable style="width: 160px" @keyup.enter="handleQuery" />
             </el-form-item>
             <el-form-item label="站点" prop="carNum">
-              <el-input v-model="queryParams.carNum" placeholder="请输入站点" clearable style="width: 160px"
-                @keyup.enter="handleQuery" />
+              <el-input v-model="queryParams.carNum" placeholder="请输入站点" clearable style="width: 160px" @keyup.enter="handleQuery" />
             </el-form-item>
             <el-form-item label="时间" prop="carNum">
-              <el-date-picker v-model="value2" type="datetimerange" :shortcuts="shortcuts" range-separator="To"
-                start-placeholder="开始时间" end-placeholder="结束时间" />
+              <el-date-picker
+                v-model="value2"
+                type="datetimerange"
+                :shortcuts="shortcuts"
+                range-separator="To"
+                start-placeholder="开始时间"
+                end-placeholder="结束时间"
+              />
             </el-form-item>
           </el-form>
         </div>
@@ -28,11 +31,9 @@
       </div>
     </transition>
     <el-card shadow="never">
+      <tableElm @childToParent="childrenClick" @childFormat="childFormat" :columns="columns" ref="table"></tableElm>
 
-      <tableElm @childToParent='childrenClick' @childFormat="childFormat" :columns="columns" ref="table"></tableElm>
-
-      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
-        v-model:limit="queryParams.pageSize" @pagination="getList" />
+      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
     </el-card>
   </div>
 </template>
@@ -45,6 +46,8 @@ import { CarPathVO, CarPathQuery, CarPathForm } from '@/api/carPath/types';
 import tableElm from "@/components/Public/table.vue";
 import { getDicts } from '@/api/system/dict/data'
 import useTagsViewStore from '@/store/modules/tagsView';
+import { ElButton } from 'element-plus';
+import { deepClone } from "@/utils";
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
@@ -130,9 +133,48 @@ const data = reactive<PageData<CarPathForm, CarPathQuery>>({
 const columns = ref([
   // {label: '上层位置', prop: 'v', visible: true},
   // { label: '车牌', prop: 'carNum', pprop: "ext1", visible: true, isTemplate: false, isTemplateJson: true },
-  { label: '作业名称', prop: 'name', pprop: "ext1", visible: true, isTemplate: false },
-  { label: '作业类型', prop: 'type', pprop: "ext2", func: "getWorkType", visible: true, isTemplate: false, isTemplateJsonFormat: true },
-  { label: '网格', prop: 'wangge', pprop: "ext2", visible: true, isTemplate: false, isTemplateJson: true},
+  { label: '路线名称', prop: 'name', pprop: "ext1", visible: true, isTemplate: false ,custom:true,render(data) {
+    return h('div', { style: 'display:flex;align-items: center;' }, [
+      h('div', {}, data.name),
+      h(ElButton, {
+        style: 'margin-left:10px', size: 'small', type: 'primary', plain: true, onClick: () => {
+          //获取路线信息
+          let insertdata = deepClone(data);
+          let name = "";
+          insertdata.stationList = JSON.stringify((JSON.parse(insertdata.stationList).sort((o1, o2) => o2.rank - o1.rank).map((item, index) => {
+            item.rank = index + 1;
+            if (index == 0) {
+              item.timeObj = {
+                "endTime": "00:00",
+                "startTime": "00:00"
+              }
+              item.color = "#0bbd87";
+            }
+            if (index == JSON.parse(insertdata.stationList).length - 1) {
+              item.timeObj = {
+                "startTime": "01:00"
+              }
+              item.color = "#E37318";
+              item.rank = 999;
+            }
+            item.content = index == 0 ? "起点" : index == JSON.parse(insertdata.stationList).length - 1 ? "终点" : item.rank;
+            name += index == 0 ? item.data.dictLabel : "";
+            name += index == JSON.parse(insertdata.stationList).length - 1 ? "-" + item.data.dictLabel : "";
+            return item;
+          })));
+          insertdata.name = name;
+          delete insertdata.id;
+          console.log( JSON.parse(insertdata.stationList));
+          addCarPath(insertdata).then(res => {
+            getList();
+          })
+        }
+      }, '反向路线')
+    ]);
+  },},
+  { label: '路线作业类型', prop: 'type', pprop: "ext2", func: "getWorkType", visible: true, isTemplate: false, isTemplateJsonFormat: true },
+  { label: '网格', prop: 'wangge', pprop: "ext2", visible: true, isTemplate: false, isTemplateJson: true },
+
   // { label: '跟车人员', prop: 'attendantInfo', visible: true, isTemplate: true, func: "getattend" },
   // { label: '驾驶员、联系方式', prop: 'driverInfo', visible: true, isTemplate: true, func: "getDriverTable" },
 ])
@@ -321,7 +363,4 @@ const initData = async () => {
 onMounted(() => {
   initData()
 });
-
-
-
-</script>
+</script>